Office.MailboxEnums.AttachmentType enum
Specifies an attachment's type.
Remarks
Applicable Outlook mode: Compose or Read
Examples
// 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.");
}
});
Fields
File = "file" | The attachment is a file. |
Item = "item" | The attachment is an Exchange item. |
Cloud = "cloud" | The attachment is stored in a cloud location, such as OneDrive. Important: In Read mode, the |
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.
Office Add-ins
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for