Skip to content

Commit 6e8dac3

Browse files
🤖 Merge PR DefinitelyTyped#72518 [office-js][office-js-preview] (Outlook) Update get/set body API definitions by @samantharamon
1 parent a7f38f0 commit 6e8dac3

File tree

1 file changed

+93
-18
lines changed

1 file changed

+93
-18
lines changed

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

Lines changed: 93 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8943,6 +8943,36 @@ declare namespace Office {
89438943
*/
89448944
Item = "item"
89458945
}
8946+
/**
8947+
* Specifies the portion of a message's body displayed for replies to a conversation thread with more than one message.
8948+
*
8949+
* @remarks
8950+
*
8951+
* **{@link https://learn.microsoft.com/office/dev/add-ins/outlook/outlook-add-ins-overview#extension-points | Applicable Outlook mode}**: Message Compose
8952+
*
8953+
* **Important**: This enum is only supported in Outlook on the web and new Outlook on Windows. On these platforms, users can organize their messages as
8954+
* conversations or individual messages in **Settings** > **Mail** > **Layout** > **Message organization**. This user setting affects the portion of the body of a message that's displayed.
8955+
*
8956+
* The `BodyMode` enum supports the following message organization settings.
8957+
*
8958+
* - Conversations: **Group messages by conversation** > **All messages from the selected conversation** or **Show email grouped by conversation** > **Newest on top**\/**Newest on bottom**
8959+
*
8960+
* - Individual messages: **Do not group messages** > **Only a single message** or **Show email as individual messages**
8961+
*
8962+
* For more information, see {@link https://support.microsoft.com/office/57fe0cd8-e90b-4b1b-91e4-a0ba658c0042 | Change how the message list is displayed in Outlook}.
8963+
*/
8964+
enum BodyMode {
8965+
/**
8966+
* The entire body of a message, including previous messages from the same conversation thread.
8967+
*/
8968+
FullBody = 0,
8969+
/**
8970+
* The body mode depends on the user's current setting for message organization (that is, messages are organized as conversations or individual messages).
8971+
* If messages are organized by conversation, it specifies only the current body of the reply. Conversely, if messages are organized as individual
8972+
* messages, it specifies the entire body of a message, including previous messages from the same conversation thread.
8973+
*/
8974+
HostConfig = 1
8975+
}
89468976
/**
89478977
* Specifies the category color.
89488978
*
@@ -13107,9 +13137,7 @@ declare namespace Office {
1310713137
*/
1310813138
appendOnSendAsync(data: string, callback?: (asyncResult: Office.AsyncResult<void>) => void): void;
1310913139
/**
13110-
* Returns the current body in a specified format.
13111-
*
13112-
* This method returns the entire current body in the format specified by `coercionType`.
13140+
* Returns the entire current body in the format specified by `coercionType`.
1311313141
*
1311413142
* @remarks
1311513143
* [Api set: Mailbox 1.3]
@@ -13128,17 +13156,28 @@ declare namespace Office {
1312813156
* if the body contains formatted elements, such as tables, lists, and links, specify `Office.CoercionType.Html` in the `getAsync` call.
1312913157
* Otherwise, you may receive an unexpected value, such as an empty string.
1313013158
*
13159+
* - In Outlook on the web and new Outlook on Windows, users can organize their messages as conversations or individual messages in **Settings** > **Mail** > **Layout** > **Message organization**
13160+
* (see {@link https://support.microsoft.com/office/57fe0cd8-e90b-4b1b-91e4-a0ba658c0042 | Change how the message list is displayed in Outlook}).
13161+
* This setting affects how much of a message's body is displayed to the user (that is, the entire conversation thread of a message or just the current message).
13162+
* In Message Compose mode, particulary for replies to a conversation thread with more than one message, if you want the returned body to reflect the user's setting,
13163+
* specify the `bodyMode: Office.MailboxEnums.BodyMode.HostConfig` parameter in your `getAsync` call. If messages are grouped by conversation,
13164+
* only the body of the current reply is returned. Conversely, if messages are displayed individually, the entire conversation thread is returned.
13165+
*
13166+
* - The `bodyMode` option isn't supported on a message that's loaded using the `loadItemByIdAsync` method. For more information, see
13167+
* {@link https://learn.microsoft.com/office/dev/add-ins/outlook/item-multi-select | Activate your Outlook add-in on multiple messages}.
13168+
*
1313113169
* @param coercionType - The format for the returned body.
13132-
* @param options - An object literal that contains one or more of the following properties:-
13133-
* `asyncContext`: Developers can provide any object they wish to access in the callback function.
13170+
* @param options - An object literal that contains one or more of the following properties.
13171+
* `asyncContext`: Any data you want to access in the callback function.
13172+
* `bodyMode`: In Outlook on the web and new Outlook on Windows, specifies whether only the body of the current message or the entire body of a message conversation is returned.
13173+
* If a value isn't specified, `bodyMode` defaults to `Office.MailboxEnums.BodyMode.FullBody`, which returns the entire body of a message conversation. The `bodyMode` property only
13174+
* applies to replies on the Message Compose surface. It's ignored in Outlook on Windows (classic), on Mac, and on mobile devices.
1313413175
* @param callback - Optional. When the method completes, the function passed in the `callback` parameter is called with a single parameter
13135-
* of type Office.AsyncResult. The body is provided in the requested format in the `asyncResult.value` property.
13176+
* of type Office.AsyncResult. The body is provided in the requested format in the `asyncResult.value` property.
1313613177
*/
13137-
getAsync(coercionType: Office.CoercionType | string, options: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult<string>) => void): void;
13178+
getAsync(coercionType: Office.CoercionType | string, options: Office.AsyncContextOptions & { bodyMode?: MailboxEnums.BodyMode }, callback?: (asyncResult: Office.AsyncResult<string>) => void): void;
1313813179
/**
13139-
* Returns the current body in a specified format.
13140-
*
13141-
* This method returns the entire current body in the format specified by `coercionType`.
13180+
* Returns the entire current body in the format specified by `coercionType`.
1314213181
*
1314313182
* @remarks
1314413183
* [Api set: Mailbox 1.3]
@@ -13157,9 +13196,16 @@ declare namespace Office {
1315713196
* if the body contains formatted elements, such as tables, lists, and links, specify `Office.CoercionType.Html` in the `getAsync` call.
1315813197
* Otherwise, you may receive an unexpected value, such as an empty string.
1315913198
*
13199+
* - In Outlook on the web and new Outlook on Windows, users can organize their messages as conversations or individual messages in **Settings** > **Mail** > **Layout** > **Message organization**
13200+
* (see {@link https://support.microsoft.com/office/57fe0cd8-e90b-4b1b-91e4-a0ba658c0042 | Change how the message list is displayed in Outlook}).
13201+
* This setting affects how much of a message's body is displayed to the user (that is, the entire conversation thread of a message or just the current message).
13202+
* In Message Compose mode, particulary for replies to a conversation thread with more than one message, if you want the returned body to reflect the user's setting,
13203+
* specify the `bodyMode: Office.MailboxEnums.BodyMode.HostConfig` parameter in your `getAsync` call. If messages are grouped by conversation,
13204+
* only the body of the current reply is returned. Conversely, if messages are displayed individually, the entire conversation thread is returned.
13205+
*
1316013206
* @param coercionType - The format for the returned body.
1316113207
* @param callback - Optional. When the method completes, the function passed in the `callback` parameter is called with a single parameter
13162-
* of type Office.AsyncResult. The body is provided in the requested format in the `asyncResult.value` property.
13208+
* of type Office.AsyncResult. The body is provided in the requested format in the `asyncResult.value` property.
1316313209
*/
1316413210
getAsync(coercionType: Office.CoercionType | string, callback?: (asyncResult: Office.AsyncResult<string>) => void): void;
1316513211
/**
@@ -13432,20 +13478,36 @@ declare namespace Office {
1343213478
* - The `setAsync` method isn't supported on a message that's currently loaded using the `loadItemByIdAsync` method.
1343313479
* For more information, see {@link https://learn.microsoft.com/office/dev/add-ins/outlook/item-multi-select | Activate your Outlook add-in on multiple messages}.
1343413480
*
13481+
* - In Outlook on the web and new Outlook on Windows, users can organize their messages as conversations or individual messages in **Settings** > **Mail** > **Layout** > **Message organization**
13482+
* (see {@link https://support.microsoft.com/office/57fe0cd8-e90b-4b1b-91e4-a0ba658c0042 | Change how the message list is displayed in Outlook}).
13483+
* This setting affects how much of a message's body is displayed to the user (that is, the entire conversation thread of a message or just the current message).
13484+
* In Message Compose mode, particulary for replies to a conversation thread with more than one message, if you want to honor the user's settings when
13485+
* setting the body of a message, specify the `bodyMode: Office.MailboxEnums.BodyMode.HostConfig` parameter in your `setAsync` call. If messages are grouped by conversation,
13486+
* only the body of the current reply is set. Conversely, if messages are displayed individually, the entire body, including previous messages
13487+
* in the conversation thread, is replaced.
13488+
*
13489+
* - In Outlook on the web and new Outlook on Windows, if the `bodyMode` property isn't specified or is set to `Office.MailboxEnums.BodyMode.FullBody`, the entire body of a message,
13490+
* including previous messages from the conversation thread, is replaced. This applies even if a user's messages are organized by conversation. In this scenario, the user's
13491+
* setting is temporarily changed to **Individual messages: Do not group messages** > **Only a single message** or **Show email as individual messages** during the `setAsync` call.
13492+
* A notification is shown to the user to alert them to this change. Once the call completes, the user's setting is reinstated.
13493+
*
1343513494
* **Errors**:
1343613495
*
1343713496
* - `DataExceedsMaximumSize`: The data parameter is longer than 1,000,000 characters.
1343813497
*
1343913498
* - `InvalidFormatError`: The `options.coercionType` parameter is set to `Office.CoercionType.Html` and the message body is in plain text.
1344013499
*
13441-
* @param data - The string that will replace the existing body. The string is limited to 1,000,000 characters.
13442-
* @param options - An object literal that contains one or more of the following properties:-
13443-
* `asyncContext`: Developers can provide any object they wish to access in the callback function.
13444-
* `coercionType`: The desired format for the body. The string in the `data` parameter will be converted to this format.
13500+
* @param data - The string that replaces the existing body. The string is limited to 1,000,000 characters.
13501+
* @param options - An object literal that contains one or more of the following properties.
13502+
* `asyncContext`: Any data you want to access in the callback function.
13503+
* `coercionType`: The desired format for the body. The string in the `data` parameter is converted to this format.
13504+
* `bodyMode`: In Outlook on the web and new Outlook on Windows, specifies whether only the body of the current message or the entire body of a message conversation is set.
13505+
* If a value isn't specified, `bodyMode` defaults to `Office.MailboxEnums.BodyMode.FullBody`, which replaces the entire body, including previous messages in the conversation thread.
13506+
* The `bodyMode` property only applies to replies on the Message Compose surface. It's ignored in Outlook on Windows (classic), on Mac, and on mobile devices.
1344513507
* @param callback - Optional. When the method completes, the function passed in the `callback` parameter is called with a single parameter
13446-
* of type Office.AsyncResult. Any errors encountered will be provided in the `asyncResult.error` property.
13508+
* of type Office.AsyncResult. Any errors encountered will be provided in the `asyncResult.error` property.
1344713509
*/
13448-
setAsync(data: string, options: Office.AsyncContextOptions & CoercionTypeOptions, callback?: (asyncResult: Office.AsyncResult<void>) => void): void;
13510+
setAsync(data: string, options: Office.AsyncContextOptions & CoercionTypeOptions & { bodyMode?: MailboxEnums.BodyMode }, callback?: (asyncResult: Office.AsyncResult<void>) => void): void;
1344913511
/**
1345013512
* Replaces the entire body with the specified text.
1345113513
*
@@ -13486,6 +13548,19 @@ declare namespace Office {
1348613548
* - The `setAsync` method isn't supported on a message that's currently loaded using the `loadItemByIdAsync` method.
1348713549
* For more information, see {@link https://learn.microsoft.com/office/dev/add-ins/outlook/item-multi-select | Activate your Outlook add-in on multiple messages}.
1348813550
*
13551+
* - In Outlook on the web and new Outlook on Windows, users can organize their messages as conversations or individual messages in **Settings** > **Mail** > **Layout** > **Message organization**
13552+
* (see {@link https://support.microsoft.com/office/57fe0cd8-e90b-4b1b-91e4-a0ba658c0042 | Change how the message list is displayed in Outlook}).
13553+
* This setting affects how much of a message's body is displayed to the user (that is, the entire conversation thread of a message or just the current message).
13554+
* In Message Compose mode, particulary for replies in a conversation thread with more than one message, if you want to honor the user's settings when
13555+
* setting the body of a message, specify the `bodyMode: Office.MailboxEnums.BodyMode.HostConfig` parameter in your `setAsync` call. If messages are grouped by conversation,
13556+
* only the body of the current reply is set. Conversely, if messages are displayed individually, the entire body, including previous messages
13557+
* in the conversation thread, is replaced.
13558+
*
13559+
* - In Outlook on the web and new Outlook on Windows, if the `bodyMode` property isn't specified or is set to `Office.MailboxEnums.BodyMode.FullBody`, the entire body of a message,
13560+
* including previous messages from the conversation thread, is replaced. This applies even if a user's messages are organized by conversation. In this scenario, the user's
13561+
* setting is temporarily changed to **Individual messages: Do not group messages** > **Only a single message** or **Show email as individual messages** during the `setAsync` call.
13562+
* A notification is shown to the user to alert them to this change. Once the call completes, the user's setting is reinstated.
13563+
*
1348913564
* **Errors**:
1349013565
*
1349113566
* - `DataExceedsMaximumSize`: The data parameter is longer than 1,000,000 characters.
@@ -13494,7 +13569,7 @@ declare namespace Office {
1349413569
*
1349513570
* @param data - The string that will replace the existing body. The string is limited to 1,000,000 characters.
1349613571
* @param callback - Optional. When the method completes, the function passed in the `callback` parameter is called with a single parameter
13497-
* of type Office.AsyncResult. Any errors encountered will be provided in the `asyncResult.error` property.
13572+
* of type Office.AsyncResult. Any errors encountered will be provided in the `asyncResult.error` property.
1349813573
*/
1349913574
setAsync(data: string, callback?: (asyncResult: Office.AsyncResult<void>) => void): void;
1350013575
/**

0 commit comments

Comments
 (0)