我知道我可以通过Office.context.mailbox.item.attachments访问附件
另外,对于每个附件,我可以访问它的成员,比如name。
但是,我真的可以访问它的内容并将其发送到外部服务器来显示吗?例如,我想向服务器发送一个pdf附件,并在服务器上显示该pdf文件的内容。
发布于 2018-08-09 23:43:22
结果,Outlook外接程序不能将选定项的附件直接传递到服务器上运行的远程服务。相反,外接程序可以使用附件API向远程服务发送有关附件的信息。然后,该服务可以直接与Exchange服务器联系以检索附件。
function getAttachmentToken() {
if (serviceRequest.attachmentToken == "") {
Office.context.mailbox.getCallbackTokenAsync(attachmentTokenCallback);
}
}
function attachmentTokenCallback(asyncResult, userContext) {
if (asyncResult.status === "succeeded") {
// Cache the result from the server.
serviceRequest.attachmentToken = asyncResult.value;
serviceRequest.state = 3;
testAttachments();
} else {
showToast("Error", "Could not get callback token: " + asyncResult.error.message);
}
}
// Initialize a context object for the add-in.
// Set the fields that are used on the request
// object to default values.
var serviceRequest = {
attachmentToken: '',
ewsUrl : Office.context.mailbox.ewsUrl,
attachments : []
};https://stackoverflow.com/questions/51762073
复制相似问题