Skip to content

Commit a15e4cd

Browse files
[office-js-preview] (Outlook) Document decryption API (DefinitelyTyped#73601)
1 parent 09644ff commit a15e4cd

File tree

2 files changed

+255
-7
lines changed

2 files changed

+255
-7
lines changed

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

Lines changed: 252 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12985,7 +12985,9 @@ declare namespace Office {
1298512985
*
1298612986
* **Important**:
1298712987
*
12988-
* - The `contentId` property is only supported in Outlook on the web and the new Outlook on Windows.
12988+
* - The `contentId` property is only supported in Outlook on the web and Outlook on Windows (new and classic (preview)).
12989+
* To preview the `contentId` property in classic Outlook on Windows, your Outlook client must run Version 2510 (Build 19312.20000)
12990+
* or later and must be on the Beta Channel. For more information, see {@link https://aka.ms/Msft365InsiderProgram | Microsoft 365 Insider Program}.
1298912991
*
1299012992
* - Starting November 15, 2025, changes to how inline images are represented in the HTML body of Outlook emails in
1299112993
* Outlook on the web and the new Outlook on Windows will begin rolling out to production users.
@@ -14249,6 +14251,164 @@ declare namespace Office {
1424914251
*/
1425014252
set(name: string, value: string): void;
1425114253
}
14254+
/**
14255+
* Represents an attachment in a decrypted message.
14256+
*
14257+
* @remarks
14258+
*
14259+
* [Api set: Mailbox preview]
14260+
*
14261+
* **{@link https://learn.microsoft.com/office/dev/add-ins/outlook/understanding-outlook-add-in-permissions | Minimum permission level}**: **read/write item**
14262+
*
14263+
* **{@link https://learn.microsoft.com/office/dev/add-ins/outlook/outlook-add-ins-overview#extension-points | Applicable Outlook mode}**: Message Read
14264+
*
14265+
* To learn how to develop an encryption add-in in Outlook, see {@link https://learn.microsoft.com/office/dev/add-ins/outlook/encryption-decryption | Create an encryption Outlook add-in}.
14266+
*
14267+
* @beta
14268+
*/
14269+
interface DecryptedMessageAttachment {
14270+
/**
14271+
* Specifies the type of attachment.
14272+
*
14273+
* @remarks
14274+
*
14275+
* [Api set: Mailbox preview]
14276+
*
14277+
* **{@link https://learn.microsoft.com/office/dev/add-ins/outlook/understanding-outlook-add-in-permissions | Minimum permission level}**: **read/write item**
14278+
*
14279+
* **{@link https://learn.microsoft.com/office/dev/add-ins/outlook/outlook-add-ins-overview#extension-points | Applicable Outlook mode}**: Message Read
14280+
*
14281+
* @beta
14282+
*/
14283+
attachmentType: MailboxEnums.AttachmentType;
14284+
/**
14285+
* Specifies the Base64-encoded content of the attachment.
14286+
*
14287+
* @remarks
14288+
*
14289+
* [Api set: Mailbox preview]
14290+
*
14291+
* **{@link https://learn.microsoft.com/office/dev/add-ins/outlook/understanding-outlook-add-in-permissions | Minimum permission level}**: **read/write item**
14292+
*
14293+
* **{@link https://learn.microsoft.com/office/dev/add-ins/outlook/outlook-add-ins-overview#extension-points | Applicable Outlook mode}**: Message Read
14294+
*
14295+
* **Important**: The `content` property isn't supported by attachments of type `MailboxEnums.AttachmentType.Cloud`.
14296+
*
14297+
* @beta
14298+
*/
14299+
content: string;
14300+
/**
14301+
* Specifies the content identifier of an inline attachment.
14302+
*
14303+
* The `contentId` property must be specified if `isInline` is set to `true`.
14304+
*
14305+
* @remarks
14306+
*
14307+
* [Api set: Mailbox preview]
14308+
*
14309+
* **{@link https://learn.microsoft.com/office/dev/add-ins/outlook/understanding-outlook-add-in-permissions | Minimum permission level}**: **read/write item**
14310+
*
14311+
* **{@link https://learn.microsoft.com/office/dev/add-ins/outlook/outlook-add-ins-overview#extension-points | Applicable Outlook mode}**: Message Read
14312+
*
14313+
* **Important**: When images are added to a message as inline attachments, they're automatically assigned a content ID. In the body of a message, the content ID of an inline attachment is
14314+
* specified in the `src` attribute of the `<img>` element (for example, `<img width=96 height=96 id="Picture_1" src="cid:[email protected]">`).
14315+
* To easily identify and provide these inline attachments during decryption, we recommend saving the content IDs of inline attachments to the message header during encryption.
14316+
* Call `Office.context.mailbox.item.getAttachmentsAsync` to get the content ID of an inline attachment. Then, call `Office.context.mailbox.item.internetHeaders.setAsync` to save the ID to the header of the message.
14317+
*
14318+
* @beta
14319+
*/
14320+
contentId?: string;
14321+
/**
14322+
* If true, specifies that the decrypted attachment appears as an image in the body of the message instead of in the attachment list.
14323+
* If the `isInline` property isn't specified, its value is set to false.
14324+
*
14325+
* @remarks
14326+
*
14327+
* [Api set: Mailbox preview]
14328+
*
14329+
* **{@link https://learn.microsoft.com/office/dev/add-ins/outlook/understanding-outlook-add-in-permissions | Minimum permission level}**: **read/write item**
14330+
*
14331+
* **{@link https://learn.microsoft.com/office/dev/add-ins/outlook/outlook-add-ins-overview#extension-points | Applicable Outlook mode}**: Message Read
14332+
*
14333+
* @beta
14334+
*/
14335+
isInline?: boolean;
14336+
/**
14337+
* Specifies the name of the attachment.
14338+
*
14339+
* @remarks
14340+
*
14341+
* [Api set: Mailbox preview]
14342+
*
14343+
* **{@link https://learn.microsoft.com/office/dev/add-ins/outlook/understanding-outlook-add-in-permissions | Minimum permission level}**: **read/write item**
14344+
*
14345+
* **{@link https://learn.microsoft.com/office/dev/add-ins/outlook/outlook-add-ins-overview#extension-points | Applicable Outlook mode}**: Message Read
14346+
*
14347+
* @beta
14348+
*/
14349+
name: string;
14350+
/**
14351+
* Specifies the URL reference path of the attachment if its type is `MailboxEnums.AttachmentType.Cloud`.
14352+
* The `path` property must be specified for attachments of type `MailboxEnums.AttachmentType.Cloud`.
14353+
*
14354+
* @remarks
14355+
*
14356+
* [Api set: Mailbox preview]
14357+
*
14358+
* **{@link https://learn.microsoft.com/office/dev/add-ins/outlook/understanding-outlook-add-in-permissions | Minimum permission level}**: **read/write item**
14359+
*
14360+
* **{@link https://learn.microsoft.com/office/dev/add-ins/outlook/outlook-add-ins-overview#extension-points | Applicable Outlook mode}**: Message Read
14361+
*
14362+
* @beta
14363+
*/
14364+
path?: string;
14365+
}
14366+
/**
14367+
* Represents the body of a decrypted message.
14368+
*
14369+
* @remarks
14370+
*
14371+
* [Api set: Mailbox preview]
14372+
*
14373+
* **{@link https://learn.microsoft.com/office/dev/add-ins/outlook/understanding-outlook-add-in-permissions | Minimum permission level}**: **read/write item**
14374+
*
14375+
* **{@link https://learn.microsoft.com/office/dev/add-ins/outlook/outlook-add-ins-overview#extension-points | Applicable Outlook mode}**: Message Read
14376+
*
14377+
* To learn how to develop an encryption add-in in Outlook, see {@link https://learn.microsoft.com/office/dev/add-ins/outlook/encryption-decryption | Create an encryption Outlook add-in}.
14378+
*
14379+
* @beta
14380+
*/
14381+
interface DecryptedMessageBody {
14382+
/**
14383+
* Specifies the format of the body of a message.
14384+
* The body of a message can be formatted as `Office.CoercionType.Html` or `Office.CoercionType.Text`.
14385+
*
14386+
* @remarks
14387+
*
14388+
* [Api set: Mailbox preview]
14389+
*
14390+
* **{@link https://learn.microsoft.com/office/dev/add-ins/outlook/understanding-outlook-add-in-permissions | Minimum permission level}**: **read/write item**
14391+
*
14392+
* **{@link https://learn.microsoft.com/office/dev/add-ins/outlook/outlook-add-ins-overview#extension-points | Applicable Outlook mode}**: Message Read
14393+
*
14394+
* @beta
14395+
*/
14396+
coercionType: Office.CoercionType;
14397+
/**
14398+
* Specifies the content displayed in the body of the message.
14399+
*
14400+
* @remarks
14401+
*
14402+
* [Api set: Mailbox preview]
14403+
*
14404+
* **{@link https://learn.microsoft.com/office/dev/add-ins/outlook/understanding-outlook-add-in-permissions | Minimum permission level}**: **read/write item**
14405+
*
14406+
* **{@link https://learn.microsoft.com/office/dev/add-ins/outlook/outlook-add-ins-overview#extension-points | Applicable Outlook mode}**: Message Read
14407+
*
14408+
* @beta
14409+
*/
14410+
content: string;
14411+
}
1425214412
/**
1425314413
* The `DelayDeliveryTime` object enables you to manage the delayed delivery date and time of a message.
1425414414
*
@@ -18760,8 +18920,9 @@ declare namespace Office {
1876018920
/**
1876118921
* The `MailboxEvent` object is passed as an argument to the event handler of an add-in that implements
1876218922
* {@link https://learn.microsoft.com/office/dev/add-ins/develop/event-based-activation | event-based activation}, including
18763-
* {@link https://learn.microsoft.com/office/dev/add-ins/outlook/onmessagesend-onappointmentsend-events | Smart Alerts},
18764-
* or the {@link https://learn.microsoft.com/office/dev/add-ins/outlook/spam-reporting | integrated spam-reporting feature}.
18923+
* {@link https://learn.microsoft.com/office/dev/add-ins/outlook/onmessagesend-onappointmentsend-events | Smart Alerts}, the
18924+
* {@link https://learn.microsoft.com/office/dev/add-ins/outlook/spam-reporting | integrated spam-reporting feature}, or
18925+
* {@link https://learn.microsoft.com/office/dev/add-ins/outlook/encryption-decryption | decryption} (preview).
1876518926
* It allows the add-in to signify to the Outlook client that it has completed processing an event.
1876618927
*
1876718928
* @remarks
@@ -18783,7 +18944,7 @@ declare namespace Office {
1878318944
*/
1878418945
interface MailboxEvent {
1878518946
/**
18786-
* Indicates that the event-based or spam-reporting add-in has completed processing an event.
18947+
* Indicates that the event-based, spam-reporting, or decryption (preview) add-in has completed processing an event.
1878718948
*
1878818949
* @remarks
1878918950
* [Api set: Mailbox 1.10]
@@ -18798,9 +18959,9 @@ declare namespace Office {
1879818959
*
1879918960
* - Support to assign a `SmartAlertsEventCompletedOptions` object to the `options` parameter was introduced in Mailbox 1.12.
1880018961
*
18801-
* @param options - Optional. An object that specifies the behavior of an event-based or spam-reporting add-in when it completes processing an event.
18962+
* @param options - Optional. An object that specifies the behavior of an event-based, spam-reporting, or decryption add-in when it completes processing an event.
1880218963
*/
18803-
completed(options?: SmartAlertsEventCompletedOptions | SpamReportingEventCompletedOptions): void;
18964+
completed(options?: SmartAlertsEventCompletedOptions | SpamReportingEventCompletedOptions | MessageDecryptEventCompletedOptions): void;
1880418965
}
1880518966
/**
1880618967
* Represents the categories master list on the mailbox.
@@ -20681,6 +20842,91 @@ declare namespace Office {
2068120842
*/
2068220843
setSelectedDataAsync(data: string, callback?: (asyncResult: Office.AsyncResult<void>) => void): void;
2068320844
}
20845+
/**
20846+
* Specifies the behavior of an {@link https://learn.microsoft.com/office/dev/add-ins/outlook/encryption-decryption | encryption add-in} after it completes processing an
20847+
* {@link https://learn.microsoft.com/javascript/api/office/office.eventtype#fields | OnMessageRead} event.
20848+
*
20849+
* @remarks
20850+
*
20851+
* [Api set: Mailbox preview]
20852+
*
20853+
* **{@link https://learn.microsoft.com/office/dev/add-ins/outlook/understanding-outlook-add-in-permissions | Minimum permission level}**: **read/write item**
20854+
*
20855+
* **{@link https://learn.microsoft.com/office/dev/add-ins/outlook/outlook-add-ins-overview#extension-points | Applicable Outlook mode}**: Message Read
20856+
*
20857+
* @beta
20858+
*/
20859+
interface MessageDecryptEventCompletedOptions {
20860+
/**
20861+
* When you use the {@link https://learn.microsoft.com/javascript/api/outlook/office.mailboxevent#outlook-office-mailboxevent-completed-member(1) | completed method} to signal completion of an event handler,
20862+
* this value indicates if the `OnMessageRead` event should continue to run or be canceled. If the `allowEvent` property is set to `true`, the decrypted contents of the message is displayed.
20863+
*
20864+
* @remarks
20865+
*
20866+
* [Api set: Mailbox preview]
20867+
*
20868+
* **{@link https://learn.microsoft.com/office/dev/add-ins/outlook/understanding-outlook-add-in-permissions | Minimum permission level}**: **read/write item**
20869+
*
20870+
* **{@link https://learn.microsoft.com/office/dev/add-ins/outlook/outlook-add-ins-overview#extension-points | Applicable Outlook mode}**: Message Read
20871+
*
20872+
* @beta
20873+
*/
20874+
allowEvent: boolean;
20875+
/**
20876+
* When you use the {@link https://learn.microsoft.com/javascript/api/outlook/office.mailboxevent#outlook-office-mailboxevent-completed-member(1) | completed method} to signal completion of an event handler
20877+
* and set its `allowEvent` property to `true`, this property sets the decrypted attachments of the message.
20878+
*
20879+
* @remarks
20880+
*
20881+
* [Api set: Mailbox preview]
20882+
*
20883+
* **{@link https://learn.microsoft.com/office/dev/add-ins/outlook/understanding-outlook-add-in-permissions | Minimum permission level}**: **read/write item**
20884+
*
20885+
* **{@link https://learn.microsoft.com/office/dev/add-ins/outlook/outlook-add-ins-overview#extension-points | Applicable Outlook mode}**: Message Read
20886+
*
20887+
* @beta
20888+
*/
20889+
attachments?: DecryptedMessageAttachment[];
20890+
/**
20891+
* When you use the {@link https://learn.microsoft.com/javascript/api/outlook/office.mailboxevent#outlook-office-mailboxevent-completed-member(1) | completed method} to signal completion of an event handler
20892+
* and set its `allowEvent` property to `true`, this property specifies any JSON data passed to the add-in for processing.
20893+
*
20894+
* @remarks
20895+
*
20896+
* [Api set: Mailbox preview]
20897+
*
20898+
* **{@link https://learn.microsoft.com/office/dev/add-ins/outlook/understanding-outlook-add-in-permissions | Minimum permission level}**: **read/write item**
20899+
*
20900+
* **{@link https://learn.microsoft.com/office/dev/add-ins/outlook/outlook-add-ins-overview#extension-points | Applicable Outlook mode}**: Message Read
20901+
*
20902+
* **Important**:
20903+
*
20904+
* - To retrieve the value of the `contextData` property, you must call `Office.context.mailbox.item.getInitializationContextAsync`.
20905+
* If you create a JSON string using `JSON.stringify()` and assign it to the `contextData` property, you must parse the string using `JSON.parse()` once you retrieve it.
20906+
*
20907+
* - You can use the `contextData` property to store custom internet headers to decrypt messages in reply and forward scenarios.
20908+
*
20909+
* @beta
20910+
*/
20911+
contextData?: any;
20912+
/**
20913+
* When you use the {@link https://learn.microsoft.com/javascript/api/outlook/office.mailboxevent#outlook-office-mailboxevent-completed-member(1) | completed method} to signal completion of an event handler
20914+
* and set its `allowEvent` property to `true`, this property sets the decrypted contents of the body of the message.
20915+
*
20916+
* @remarks
20917+
*
20918+
* [Api set: Mailbox preview]
20919+
*
20920+
* **{@link https://learn.microsoft.com/office/dev/add-ins/outlook/understanding-outlook-add-in-permissions | Minimum permission level}**: **read/write item**
20921+
*
20922+
* **{@link https://learn.microsoft.com/office/dev/add-ins/outlook/outlook-add-ins-overview#extension-points | Applicable Outlook mode}**: Message Read
20923+
*
20924+
* **Important**: If the `emailBody` property isn't specified, an empty body is returned.
20925+
*
20926+
* @beta
20927+
*/
20928+
emailBody?: DecryptedMessageBody;
20929+
}
2068420930
/**
2068520931
* The message read mode of {@link Office.Item | Office.context.mailbox.item}.
2068620932
*

types/office-js/index.d.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12938,7 +12938,9 @@ declare namespace Office {
1293812938
*
1293912939
* **Important**:
1294012940
*
12941-
* - The `contentId` property is only supported in Outlook on the web and the new Outlook on Windows.
12941+
* - The `contentId` property is only supported in Outlook on the web and Outlook on Windows (new and classic (preview)).
12942+
* To preview the `contentId` property in classic Outlook on Windows, your Outlook client must run Version 2510 (Build 19312.20000)
12943+
* or later and must be on the Beta Channel. For more information, see {@link https://aka.ms/Msft365InsiderProgram | Microsoft 365 Insider Program}.
1294212944
*
1294312945
* - Starting November 15, 2025, changes to how inline images are represented in the HTML body of Outlook emails in
1294412946
* Outlook on the web and the new Outlook on Windows will begin rolling out to production users.

0 commit comments

Comments
 (0)