Skip to content

Commit 5d89225

Browse files
[office-js] [office-js-preview] (Outlook) Update AttachmentType.cloud... (DefinitelyTyped#44905)
* [office-js] [office-js-preview] (Outlook) Update AttachmentType.cloud description * Split out into compose and read objects * Updates based on feedback
1 parent 9539685 commit 5d89225

File tree

2 files changed

+124
-39
lines changed

2 files changed

+124
-39
lines changed

types/office-js-preview/index.d.ts

Lines changed: 60 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7991,7 +7991,12 @@ declare namespace Office {
79917991
*/
79927992
Item = "item",
79937993
/**
7994-
* The attachment is stored in a cloud location, such as OneDrive. The `id` property of the attachment contains a URL to the file.
7994+
* The attachment is stored in a cloud location, such as OneDrive.
7995+
*
7996+
* **Important**: In Read mode, the `id` property of the attachment's {@link Office.AttachmentDetailsRead | details} object
7997+
* contains a URL to the file.
7998+
* From requirement set 1.8, the `url` property included in the attachment's {@link Office.AttachmentDetailsCompose | details} object
7999+
* contains a URL to the file in Compose mode.
79958000
*/
79968001
Cloud = "cloud"
79978002
}
@@ -9804,7 +9809,7 @@ declare namespace Office {
98049809
* type `Office.AsyncResult`. If the call fails, the `asyncResult.error` property will contain an error code with the reason for
98059810
* the failure.
98069811
*/
9807-
getAttachmentsAsync(options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult<AttachmentDetails[]>) => void): void;
9812+
getAttachmentsAsync(options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult<AttachmentDetailsCompose[]>) => void): void;
98089813
/**
98099814
* Gets the item's attachments as an array.
98109815
*
@@ -9820,7 +9825,7 @@ declare namespace Office {
98209825
* type `Office.AsyncResult`. If the call fails, the `asyncResult.error` property will contain an error code with the reason for
98219826
* the failure.
98229827
*/
9823-
getAttachmentsAsync(callback?: (asyncResult: Office.AsyncResult<AttachmentDetails[]>) => void): void;
9828+
getAttachmentsAsync(callback?: (asyncResult: Office.AsyncResult<AttachmentDetailsCompose[]>) => void): void;
98249829
/**
98259830
* Gets initialization data passed when the add-in is activated by an actionable message.
98269831
*
@@ -10514,7 +10519,7 @@ declare namespace Office {
1051410519
* {@link https://support.office.com/article/Blocked-attachments-in-Outlook-434752E1-02D3-4E90-9124-8B81E49A8519 | Blocked attachments in Outlook}.
1051510520
*
1051610521
*/
10517-
attachments: AttachmentDetails[];
10522+
attachments: AttachmentDetailsRead[];
1051810523
/**
1051910524
* Gets an object that provides methods for manipulating the body of an item.
1052010525
*
@@ -11383,30 +11388,73 @@ declare namespace Office {
1138311388
*/
1138411389
format: MailboxEnums.AttachmentContentFormat | string;
1138511390
}
11391+
/**
11392+
* Represents an attachment on an item. Compose mode only.
11393+
*
11394+
* An array of `AttachmentDetailsCompose` objects is returned as the attachments property of an appointment or message item.
11395+
*
11396+
* [Api set: Mailbox 1.8]
11397+
*
11398+
* @remarks
11399+
*
11400+
* **{@link https://docs.microsoft.com/office/dev/add-ins/outlook/understanding-outlook-add-in-permissions | Minimum permission level}**: `ReadItem`
11401+
*
11402+
* **{@link https://docs.microsoft.com/office/dev/add-ins/outlook/outlook-add-ins-overview#extension-points | Applicable Outlook mode}**: Compose
11403+
*/
11404+
interface AttachmentDetailsCompose {
11405+
/**
11406+
* Gets a value that indicates the type of an attachment.
11407+
*/
11408+
attachmentType: MailboxEnums.AttachmentType | string;
11409+
/**
11410+
* Gets the index of the attachment.
11411+
*/
11412+
id: string;
11413+
/**
11414+
* Gets a value that indicates whether the attachment should be displayed in the body of the item.
11415+
*/
11416+
isInline: boolean;
11417+
/**
11418+
* Gets the name of the attachment.
11419+
*
11420+
* **Important**: For message or appointment items that were attached by drag-and-drop or "Attach Item",
11421+
* `name` includes a file extension in Outlook on Mac, but excludes the extension on the web or Windows.
11422+
*/
11423+
name: string;
11424+
/**
11425+
* Gets the size of the attachment in bytes.
11426+
*/
11427+
size: number;
11428+
/**
11429+
* Gets the url of the attachment if its type is `MailboxEnums.AttachmentType.Cloud`.
11430+
*/
11431+
url: string;
11432+
}
1138611433
/**
1138711434
* Represents an attachment on an item from the server. Read mode only.
1138811435
*
11389-
* An array of `AttachmentDetails` objects is returned as the attachments property of an appointment or message item.
11436+
* An array of `AttachmentDetailsRead` objects is returned as the attachments property of an appointment or message item.
11437+
*
11438+
* [Api set: Mailbox 1.1]
1139011439
*
1139111440
* @remarks
1139211441
*
1139311442
* **{@link https://docs.microsoft.com/office/dev/add-ins/outlook/understanding-outlook-add-in-permissions | Minimum permission level}**: `ReadItem`
1139411443
*
1139511444
* **{@link https://docs.microsoft.com/office/dev/add-ins/outlook/outlook-add-ins-overview#extension-points | Applicable Outlook mode}**: Read
1139611445
*/
11397-
interface AttachmentDetails {
11446+
interface AttachmentDetailsRead {
1139811447
/**
1139911448
* Gets a value that indicates the type of an attachment.
1140011449
*/
1140111450
attachmentType: MailboxEnums.AttachmentType | string;
1140211451
/**
1140311452
* Gets the MIME content type of the attachment.
11404-
*
11405-
* This property is only available in Read mode.
1140611453
*/
1140711454
contentType: string;
1140811455
/**
1140911456
* Gets the Exchange attachment ID of the attachment.
11457+
* However, if the attachment type is `MailboxEnums.AttachmentType.Cloud`, then a URL for the file is returned.
1141011458
*/
1141111459
id: string;
1141211460
/**
@@ -11424,12 +11472,6 @@ declare namespace Office {
1142411472
* Gets the size of the attachment in bytes.
1142511473
*/
1142611474
size: number;
11427-
/**
11428-
* Gets the url of the attachment if its type is `MailboxEnums.AttachmentType.Cloud`.
11429-
*
11430-
* [Api set: Mailbox 1.8]
11431-
*/
11432-
url: string;
1143311475
}
1143411476
/**
1143511477
* Provides information about the attachments that raised the `Office.EventType.AttachmentsChanged` event.
@@ -11439,7 +11481,7 @@ declare namespace Office {
1143911481
export interface AttachmentsChangedEventArgs {
1144011482
/**
1144111483
* Represents the set of attachments that were added or removed.
11442-
* For each such attachment, gets a subset of {@link Office.AttachmentDetails | AttachmentDetails} properties: `id`, `name`, `size`, and `attachmentType`.
11484+
* For each such attachment, gets `id`, `name`, `size`, and `attachmentType` properties.
1144311485
*
1144411486
* [Api set: Mailbox 1.8]
1144511487
*/
@@ -14308,7 +14350,7 @@ declare namespace Office {
1430814350
* type `Office.AsyncResult`. If the call fails, the `asyncResult.error` property will contain an error code with the reason for
1430914351
* the failure.
1431014352
*/
14311-
getAttachmentsAsync(options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult<AttachmentDetails[]>) => void): void;
14353+
getAttachmentsAsync(options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult<AttachmentDetailsCompose[]>) => void): void;
1431214354
/**
1431314355
* Gets the item's attachments as an array.
1431414356
*
@@ -14324,7 +14366,7 @@ declare namespace Office {
1432414366
* type `Office.AsyncResult`. If the call fails, the `asyncResult.error` property will contain an error code with the reason for
1432514367
* the failure.
1432614368
*/
14327-
getAttachmentsAsync(callback?: (asyncResult: Office.AsyncResult<AttachmentDetails[]>) => void): void;
14369+
getAttachmentsAsync(callback?: (asyncResult: Office.AsyncResult<AttachmentDetailsCompose[]>) => void): void;
1432814370
/**
1432914371
* Specifies the type of message compose and its coercion type. The message can be new, or a reply or forward.
1433014372
* The coercion type can be HTML or plain text.
@@ -14877,7 +14919,7 @@ declare namespace Office {
1487714919
* {@link https://support.office.com/article/Blocked-attachments-in-Outlook-434752E1-02D3-4E90-9124-8B81E49A8519 | Blocked attachments in Outlook}.
1487814920
*
1487914921
*/
14880-
attachments: AttachmentDetails[];
14922+
attachments: AttachmentDetailsRead[];
1488114923
/**
1488214924
* Gets an object that provides methods for manipulating the body of an item.
1488314925
*

types/office-js/index.d.ts

Lines changed: 64 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7666,7 +7666,13 @@ declare namespace Office {
76667666
*/
76677667
Item = "item",
76687668
/**
7669-
* The attachment is stored in a cloud location, such as OneDrive. The `id` property of the attachment contains a URL to the file.
7669+
* The attachment is stored in a cloud location, such as OneDrive.
7670+
*
7671+
* **Important**: In Read mode, the `id` property of the attachment's {@link Office.AttachmentDetailsRead | details} object
7672+
* contains a URL to the file.
7673+
* From requirement set 1.8, the `url` property included in the attachment's
7674+
* {@link https://docs.microsoft.com/javascript/api/outlook/office.attachmentdetailscompose?view=outlook-js-1.8 | details} object
7675+
* contains a URL to the file in Compose mode.
76707676
*/
76717677
Cloud = "cloud"
76727678
}
@@ -9374,7 +9380,7 @@ declare namespace Office {
93749380
* type `Office.AsyncResult`. If the call fails, the `asyncResult.error` property will contain an error code with the reason for
93759381
* the failure.
93769382
*/
9377-
getAttachmentsAsync(options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult<AttachmentDetails[]>) => void): void;
9383+
getAttachmentsAsync(options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult<AttachmentDetailsCompose[]>) => void): void;
93789384
/**
93799385
* Gets the item's attachments as an array.
93809386
*
@@ -9390,7 +9396,7 @@ declare namespace Office {
93909396
* type `Office.AsyncResult`. If the call fails, the `asyncResult.error` property will contain an error code with the reason for
93919397
* the failure.
93929398
*/
9393-
getAttachmentsAsync(callback?: (asyncResult: Office.AsyncResult<AttachmentDetails[]>) => void): void;
9399+
getAttachmentsAsync(callback?: (asyncResult: Office.AsyncResult<AttachmentDetailsCompose[]>) => void): void;
93949400
/**
93959401
* Asynchronously gets the ID of a saved item.
93969402
*
@@ -9986,7 +9992,7 @@ declare namespace Office {
99869992
* {@link https://support.office.com/article/Blocked-attachments-in-Outlook-434752E1-02D3-4E90-9124-8B81E49A8519 | Blocked attachments in Outlook}.
99879993
*
99889994
*/
9989-
attachments: AttachmentDetails[];
9995+
attachments: AttachmentDetailsRead[];
99909996
/**
99919997
* Gets an object that provides methods for manipulating the body of an item.
99929998
*
@@ -10779,30 +10785,73 @@ declare namespace Office {
1077910785
*/
1078010786
format: MailboxEnums.AttachmentContentFormat | string;
1078110787
}
10788+
/**
10789+
* Represents an attachment on an item. Compose mode only.
10790+
*
10791+
* An array of `AttachmentDetailsCompose` objects is returned as the attachments property of an appointment or message item.
10792+
*
10793+
* [Api set: Mailbox 1.8]
10794+
*
10795+
* @remarks
10796+
*
10797+
* **{@link https://docs.microsoft.com/office/dev/add-ins/outlook/understanding-outlook-add-in-permissions | Minimum permission level}**: `ReadItem`
10798+
*
10799+
* **{@link https://docs.microsoft.com/office/dev/add-ins/outlook/outlook-add-ins-overview#extension-points | Applicable Outlook mode}**: Compose
10800+
*/
10801+
interface AttachmentDetailsCompose {
10802+
/**
10803+
* Gets a value that indicates the type of an attachment.
10804+
*/
10805+
attachmentType: MailboxEnums.AttachmentType | string;
10806+
/**
10807+
* Gets the index of the attachment.
10808+
*/
10809+
id: string;
10810+
/**
10811+
* Gets a value that indicates whether the attachment should be displayed in the body of the item.
10812+
*/
10813+
isInline: boolean;
10814+
/**
10815+
* Gets the name of the attachment.
10816+
*
10817+
* **Important**: For message or appointment items that were attached by drag-and-drop or "Attach Item",
10818+
* `name` includes a file extension in Outlook on Mac, but excludes the extension on the web or Windows.
10819+
*/
10820+
name: string;
10821+
/**
10822+
* Gets the size of the attachment in bytes.
10823+
*/
10824+
size: number;
10825+
/**
10826+
* Gets the url of the attachment if its type is `MailboxEnums.AttachmentType.Cloud`.
10827+
*/
10828+
url: string;
10829+
}
1078210830
/**
1078310831
* Represents an attachment on an item from the server. Read mode only.
1078410832
*
10785-
* An array of `AttachmentDetails` objects is returned as the attachments property of an appointment or message item.
10833+
* An array of `AttachmentDetailsRead` objects is returned as the attachments property of an appointment or message item.
10834+
*
10835+
* [Api set: Mailbox 1.1]
1078610836
*
1078710837
* @remarks
10788-
*
10838+
*
1078910839
* **{@link https://docs.microsoft.com/office/dev/add-ins/outlook/understanding-outlook-add-in-permissions | Minimum permission level}**: `ReadItem`
10790-
*
10840+
*
1079110841
* **{@link https://docs.microsoft.com/office/dev/add-ins/outlook/outlook-add-ins-overview#extension-points | Applicable Outlook mode}**: Read
1079210842
*/
10793-
interface AttachmentDetails {
10843+
interface AttachmentDetailsRead {
1079410844
/**
1079510845
* Gets a value that indicates the type of an attachment.
1079610846
*/
1079710847
attachmentType: MailboxEnums.AttachmentType | string;
1079810848
/**
1079910849
* Gets the MIME content type of the attachment.
10800-
*
10801-
* This property is only available in Read mode.
1080210850
*/
1080310851
contentType: string;
1080410852
/**
1080510853
* Gets the Exchange attachment ID of the attachment.
10854+
* However, if the attachment type is `MailboxEnums.AttachmentType.Cloud`, then a URL for the file is returned.
1080610855
*/
1080710856
id: string;
1080810857
/**
@@ -10811,7 +10860,7 @@ declare namespace Office {
1081110860
isInline: boolean;
1081210861
/**
1081310862
* Gets the name of the attachment.
10814-
*
10863+
*
1081510864
* **Important**: For message or appointment items that were attached by drag-and-drop or "Attach Item",
1081610865
* `name` includes a file extension in Outlook on Mac, but excludes the extension on the web or Windows.
1081710866
*/
@@ -10820,12 +10869,6 @@ declare namespace Office {
1082010869
* Gets the size of the attachment in bytes.
1082110870
*/
1082210871
size: number;
10823-
/**
10824-
* Gets the url of the attachment if its type is `MailboxEnums.AttachmentType.Cloud`.
10825-
*
10826-
* [Api set: Mailbox 1.8]
10827-
*/
10828-
url: string;
1082910872
}
1083010873
/**
1083110874
* Provides information about the attachments that raised the `Office.EventType.AttachmentsChanged` event.
@@ -10835,7 +10878,7 @@ declare namespace Office {
1083510878
export interface AttachmentsChangedEventArgs {
1083610879
/**
1083710880
* Represents the set of attachments that were added or removed.
10838-
* For each such attachment, gets a subset of {@link Office.AttachmentDetails | AttachmentDetails} properties: `id`, `name`, `size`, and `attachmentType`.
10881+
* For each such attachment, gets `id`, `name`, `size`, and `attachmentType` properties.
1083910882
*
1084010883
* [Api set: Mailbox 1.8]
1084110884
*/
@@ -13515,7 +13558,7 @@ declare namespace Office {
1351513558
* type `Office.AsyncResult`. If the call fails, the `asyncResult.error` property will contain an error code with the reason for
1351613559
* the failure.
1351713560
*/
13518-
getAttachmentsAsync(options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult<AttachmentDetails[]>) => void): void;
13561+
getAttachmentsAsync(options?: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult<AttachmentDetailsCompose[]>) => void): void;
1351913562
/**
1352013563
* Gets the item's attachments as an array.
1352113564
*
@@ -13531,7 +13574,7 @@ declare namespace Office {
1353113574
* type `Office.AsyncResult`. If the call fails, the `asyncResult.error` property will contain an error code with the reason for
1353213575
* the failure.
1353313576
*/
13534-
getAttachmentsAsync(callback?: (asyncResult: Office.AsyncResult<AttachmentDetails[]>) => void): void;
13577+
getAttachmentsAsync(callback?: (asyncResult: Office.AsyncResult<AttachmentDetailsCompose[]>) => void): void;
1353513578
/**
1353613579
* Asynchronously gets the ID of a saved item.
1353713580
*
@@ -13942,7 +13985,7 @@ declare namespace Office {
1394213985
* {@link https://support.office.com/article/Blocked-attachments-in-Outlook-434752E1-02D3-4E90-9124-8B81E49A8519 | Blocked attachments in Outlook}.
1394313986
*
1394413987
*/
13945-
attachments: AttachmentDetails[];
13988+
attachments: AttachmentDetailsRead[];
1394613989
/**
1394713990
* Gets an object that provides methods for manipulating the body of an item.
1394813991
*

0 commit comments

Comments
 (0)