【发布时间】:2016-04-06 09:15:51
【问题描述】:
我正在添加一个“添加附件”命令作为 Office Outlook 加载项的一部分。
我想找到一种通过授权从 URL 添加文件的方法。
我想用 ajax 下载它,然后从 blob 中保存它,但看起来该命令不支持它。 我的代码测试它失败了:
const text = 'attachment content';
const blob = new Blob([text], {type: 'text/plain'});
const attachmentURI = window.URL.createObjectURL(blob);
Office.context.mailbox.item.addFileAttachmentAsync(
attachmentURI,
'file.txt',
{ asyncContext: null },
function (asyncResult) {
if(asyncResult.status == Office.AsyncResultStatus.Failed){
console.log('error adding attachment: ' + asyncResult.error.message);
}
else {
const attachmentID = asyncResult.value;
console.log('added attachment: ' + attachmentID);
}
}
);
关于从具有权限的 URL 保存附件的任何建议?
函数文档: https://dev.office.com/docs/add-ins/outlook/add-and-remove-attachments-to-an-item-in-a-compose-form
【问题讨论】:
标签: outlook ms-office office365 outlook-web-addins