尝试通过addFileAttachmentAsync()
方法添加附件时,我在使用基于Web的Outlook插件时出现问题。当用户触发addFileAttachmentAsync()
时,他们会收到错误The attachment path is invalid
。我只是在Windows机器上通过Outlook 2016向一个用户提出此问题。如果用户在OWA中打开加载项,则一切正常并添加附件。此外,如果我在其他Windows机器上尝试它,它可以正常工作。
我让用户在浏览器中测试附件的路径,并且可以访问该文件。所以它看起来不像是被防火墙或防病毒软件阻止了。
我还注意到此用户的加载项的功能区图标未呈现,而是使用默认的Outlook加载项图标(这也不会发生在其他系统或OWA中)。奇怪的部分是自我未被阻止的加载项,只有Icon图像和附件,它们都是渲染页面的同一Web应用程序的静态资产。
我认为这必须是他们的Outlook客户端或IE设置的配置问题。我只是不确定是什么设置,任何人都知道可能导致这种情况的原因?
我不相信代码中存在错误,因为这是唯一遇到此问题的用户,但这里是适当衡量的代码
Attachemnt网址:
https://host.com/assets/email.txt
附件代码:
Office.context.mailbox.item.addFileAttachmentAsync( response.attachment_url, response.attachment_name, { asyncContext: null }, function(asyncResult) {
if(asyncResult.status == Office.AsyncResultStatus.Succeeded) {
sidepane_status('success', 'Encryption attachment successfully added. Important: if attachment is removed, message is no longer encrypted.');
} else {
sidepane_status('error', 'Unable to add encryption attachment: ' + asyncResult.error.message);
}
});
清单中的图标:
<IconUrl DefaultValue="https://host.com/images/icon_small.png" />
<HighResolutionIconUrl DefaultValue="https://host.com/images/icon.png" />
(清理主机名和端口,但端点是相同的)
更新1:
Outlook客户端版本:Outlook 2016 MSO(16.0.4639.1000)64位