Office.MailboxEnums.AttachmentType enum
指定附件的类型。
注解
适用的 Outlook 模式:撰写或阅读
示例
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/40-attachments/attachments-compose.yaml
Office.context.mailbox.item.getAttachmentsAsync((result) => {
if (result.status === Office.AsyncResultStatus.Failed) {
console.error(result.error.message);
return;
}
if (result.value.length > 0) {
for (let i = 0; i < result.value.length; i++) {
const attachment = result.value[i];
let attachmentType;
switch (attachment.attachmentType) {
case Office.MailboxEnums.AttachmentType.Cloud:
attachmentType = "Attachment is stored in a cloud location";
break;
case Office.MailboxEnums.AttachmentType.File:
attachmentType = "Attachment is a file";
break;
case Office.MailboxEnums.AttachmentType.Item:
attachmentType = "Attachment is an Exchange item";
break;
}
console.log(
"ID: " +
attachment.id +
"\n" +
"Type: " +
attachmentType +
"\n" +
"Name: " +
attachment.name +
"\n" +
"Size: " +
attachment.size +
"\n" +
"isInline: " +
attachment.isInline
);
}
} else {
console.log("No attachments on this message.");
}
});
字段
File = "file" | 附件是一个文件。 |
Item = "item" | 附件是一个 Exchange 项目。 |
Cloud = "cloud" | 附件存储在云位置(如 OneDrive)中。 重要提示:在读取模式下, |