-
Notifications
You must be signed in to change notification settings - Fork 62
/
office.attachmentcontent.yml
101 lines (84 loc) · 3.73 KB
/
office.attachmentcontent.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
### YamlMime:TSType
name: Office.AttachmentContent
uid: 'outlook!Office.AttachmentContent:interface'
package: outlook!
fullName: Office.AttachmentContent
summary: Represents the content of an attachment on a message or appointment item.
remarks: >-
\[ [API set: Mailbox 1.8](/javascript/api/requirement-sets/outlook/outlook-api-requirement-sets) \]
**[Minimum permission
level](https://learn.microsoft.com/office/dev/add-ins/outlook/understanding-outlook-add-in-permissions)<!-- -->**:
**read item**
**[Applicable Outlook
mode](https://learn.microsoft.com/office/dev/add-ins/outlook/outlook-add-ins-overview#extension-points)<!-- -->**:
Compose or Read
isPreview: false
isDeprecated: false
type: interface
properties:
- name: content
uid: 'outlook!Office.AttachmentContent#content:member'
package: outlook!
fullName: content
summary: The content of an attachment as a string.
remarks: ''
isPreview: false
isDeprecated: false
syntax:
content: 'content: string;'
return:
type: string
- name: format
uid: 'outlook!Office.AttachmentContent#format:member'
package: outlook!
fullName: format
summary: >-
The string format to use for an attachment's content.
For file attachments, the formatting is a base64-encoded string.
For item attachments that represent messages and were attached by drag-and-drop or "Attach Item", the formatting
is a string representing an .eml formatted file. **Important**: If a message item was attached by
drag-and-drop in Outlook on the web, then `getAttachmentContentAsync` throws an error.
For item attachments that represent calendar items and were attached by drag-and-drop or "Attach Item", the
formatting is a string representing an .icalendar file. **Important**: If a calendar item was attached by
drag-and-drop in Outlook on the web, then `getAttachmentContentAsync` throws an error.
For cloud attachments, the formatting is a URL string.
remarks: ''
isPreview: false
isDeprecated: false
syntax:
content: 'format: MailboxEnums.AttachmentContentFormat | string;'
return:
type: '<xref uid="outlook!Office.MailboxEnums.AttachmentContentFormat:enum" /> | string'
description: |-
#### Examples
```TypeScript
const item = Office.context.mailbox.item;
const options = {asyncContext: {currentItem: item}};
item.getAttachmentsAsync(options, callback);
function callback(result) {
if (result.value.length > 0) {
for (let i = 0 ; i < result.value.length ; i++) {
result.asyncContext.currentItem.getAttachmentContentAsync(result.value[i].id, handleAttachmentsCallback);
}
}
}
function handleAttachmentsCallback(result) {
// Parse string to be a url, an .eml file, a base64-encoded string, or an .icalendar file.
switch (result.value.format) {
case Office.MailboxEnums.AttachmentContentFormat.Base64:
// Handle file attachment.
break;
case Office.MailboxEnums.AttachmentContentFormat.Eml:
// Handle email item attachment.
break;
case Office.MailboxEnums.AttachmentContentFormat.ICalendar:
// Handle .icalender attachment.
break;
case Office.MailboxEnums.AttachmentContentFormat.Url:
// Handle cloud attachment.
break;
default:
// Handle attachment formats that are not supported.
}
}
```