Skip to content

Commit 43b853a

Browse files
[Outlook] Map code snippet to Office.AttachmentDetailsCompose (#996)
1 parent f976b1b commit 43b853a

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed
-19 Bytes
Binary file not shown.

snippet-extractor-output/snippets.yaml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10469,6 +10469,54 @@
1046910469
} else {
1047010470
console.log("This mail item doesn't contain any attachments.");
1047110471
}
10472+
'Office.AttachmentDetailsCompose:interface':
10473+
- >-
10474+
// Link to full sample:
10475+
https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/40-attachments/attachments-compose.yaml
10476+
10477+
10478+
Office.context.mailbox.item.getAttachmentsAsync((result) => {
10479+
if (result.status === Office.AsyncResultStatus.Failed) {
10480+
console.error(result.error.message);
10481+
return;
10482+
}
10483+
10484+
if (result.value.length > 0) {
10485+
for (let i = 0; i < result.value.length; i++) {
10486+
const attachment = result.value[i];
10487+
let attachmentType;
10488+
switch (attachment.attachmentType) {
10489+
case Office.MailboxEnums.AttachmentType.Cloud:
10490+
attachmentType = "Attachment is stored in a cloud location";
10491+
break;
10492+
case Office.MailboxEnums.AttachmentType.File:
10493+
attachmentType = "Attachment is a file";
10494+
break;
10495+
case Office.MailboxEnums.AttachmentType.Item:
10496+
attachmentType = "Attachment is an Exchange item";
10497+
break;
10498+
}
10499+
console.log(
10500+
"ID: " +
10501+
attachment.id +
10502+
"\n" +
10503+
"Type: " +
10504+
attachmentType +
10505+
"\n" +
10506+
"Name: " +
10507+
attachment.name +
10508+
"\n" +
10509+
"Size: " +
10510+
attachment.size +
10511+
"\n" +
10512+
"isInline: " +
10513+
attachment.isInline
10514+
);
10515+
}
10516+
} else {
10517+
console.log("No attachments on this message.");
10518+
}
10519+
});
1047210520
'Office.Body:interface':
1047310521
- >-
1047410522
// Link to full sample:

0 commit comments

Comments
 (0)