addFileAttachmentAsync()产生我无法查看/打开的附件

时间:2019-08-12 10:52:33

标签: javascript asynchronous office-js office-addins outlook-web-addins

我正在创建一个Outlook加载项,并且试图通过该加载项将文档附加到撰写电子邮件中。我正在使用addFileAttachmentAsync()方法。这是我的代码:

Office.context.mailbox.item.addFileAttachmentAsync(
    url,
    docName,
    function (asyncResult) {
        if (asyncResult.status == Office.AsyncResultStatus.Succeeded) {
            // Get the ID of the attached file.
            var attachmentID = asyncResult.value;
        }
    });

此调用的结果成功,因为我可以获取结果的附件ID。 但是,即时通讯无法打开附件。例如,当尝试打开docx文档时,出现错误Word found unreadable content in _____. 同样在Chrome浏览器中,我收到错误Sorry, we ran into a problem while opening this document.

运行代码时没有任何错误,但是打开文件时出现错误:

Access to XMLHttpRequest at https://browser.pipe.aria.microsoft.com/ping from origin https://euc-word-view.officeapps.live.com has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

0 个答案:

没有答案