从邮件读取Outlook加载项文件

时间:2020-01-31 09:20:17

标签: outlook outlook-web-addins

我正在使用Outlook加载项。我无法在插件代码中使用方法item.getAttachmentsAsync加载和读取文件内容。 我收到错误TypeError:item.getAttachmentsAsync在运行时不是一个函数。

var item = Office.context.mailbox.item;
var options = {asyncContext: {currentItem: item}};
item.getAttachmentsAsync(options, this.callback);

我的要求在下面说明,

在插件中,我们有一个表单,邮件正文中填充了几个字段。 而且我需要邮件附件才能自动上传到表单。

请提出一种更好的方法。

1 个答案:

答案 0 :(得分:0)

使用getAttachmentContentAsync我可以将文件作为Blob获取。但是问题是我们需要在邮件打开后尽快调用此方法。否则会出现cors错误