Skip to content

Commit b9d1c33

Browse files
[office-js-preview] (Outlook) Document token status APIs (DefinitelyTyped#74041)
1 parent dd9f934 commit b9d1c33

File tree

1 file changed

+134
-0
lines changed

1 file changed

+134
-0
lines changed

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

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10402,6 +10402,35 @@ declare namespace Office {
1040210402
*/
1040310403
Subject = "subject"
1040410404
}
10405+
/**
10406+
* Specifies the status of Exchange Web Services (EWS) callback tokens or REST API tokens in an organization.
10407+
*
10408+
* @remarks
10409+
* [Api set: Mailbox preview]
10410+
*
10411+
* **{@link https://learn.microsoft.com/office/dev/add-ins/outlook/outlook-add-ins-overview#extension-points | Applicable Outlook mode}**: Compose or Read
10412+
*
10413+
* **Important**: Legacy Exchange Online user identity tokens and callback tokens are no longer supported and are turned off across all Microsoft 365 tenants.
10414+
* If an Outlook add-in requires delegated user access or user identity, we recommend using MSAL (Microsoft Authentication Library) and nested app authentication (NAA).
10415+
* Exchange user identity tokens are still supported for Exchange on-premises. For more information, see
10416+
* {@link https://learn.microsoft.com/office/dev/add-ins/outlook/faq-nested-app-auth-outlook-legacy-tokens | Nested app authentication FAQ}.
10417+
*
10418+
* @beta
10419+
*/
10420+
enum TokenStatus {
10421+
/**
10422+
* EWS callback tokens or REST API tokens are turned off in the organization.
10423+
*/
10424+
Disabled = 0,
10425+
/**
10426+
* EWS callback tokens or REST API tokens are supported in the organization.
10427+
*/
10428+
Enabled = 1,
10429+
/**
10430+
* The mailbox is hosted in an Exchange Online environment where EWS tokens are turned off and are no longer supported.
10431+
*/
10432+
Removed = 2
10433+
}
1040510434
/**
1040610435
* Specifies the week of the month.
1040710436
*
@@ -14611,6 +14640,29 @@ declare namespace Office {
1461114640
* property to get similar information.
1461214641
*/
1461314642
interface Diagnostics {
14643+
/**
14644+
* Gets an object to identify whether Exchange Web Services (EWS) callback tokens are supported in an organization.
14645+
*
14646+
* @remarks
14647+
*
14648+
* [Api set: Mailbox preview]
14649+
*
14650+
* **{@link https://learn.microsoft.com/office/dev/add-ins/outlook/understanding-outlook-add-in-permissions | Minimum permission level}**: **read item**
14651+
*
14652+
* **{@link https://learn.microsoft.com/office/dev/add-ins/outlook/outlook-add-ins-overview#extension-points | Applicable Outlook mode}**: Compose or Read
14653+
*
14654+
* **Important**:
14655+
*
14656+
* - The `ews` property is available for preview in Outlook on the web and on Windows (new and classic (Version 2510, Build 19328.20000 and later)).
14657+
*
14658+
* - Legacy Exchange Online user identity tokens and callback tokens are no longer supported and are turned off across all Microsoft 365 tenants.
14659+
* If an Outlook add-in requires delegated user access or user identity, we recommend using MSAL (Microsoft Authentication Library) and nested app authentication (NAA).
14660+
* Exchange user identity tokens are still supported for Exchange on-premises. For more information, see
14661+
* {@link https://learn.microsoft.com/office/dev/add-ins/outlook/faq-nested-app-auth-outlook-legacy-tokens | Nested app authentication FAQ}.
14662+
*
14663+
* @beta
14664+
*/
14665+
ews: Ews;
1461414666
/**
1461514667
* Gets a string that represents the type of Outlook client.
1461614668
*
@@ -15372,6 +15424,82 @@ declare namespace Office {
1537215424
*/
1537315425
urls: string[];
1537415426
}
15427+
/**
15428+
* Provides methods to determine if Exchange Web Services (EWS) callback tokens are supported in an organization.
15429+
*
15430+
* @remarks
15431+
*
15432+
* [Api set: Mailbox preview]
15433+
*
15434+
* **{@link https://learn.microsoft.com/office/dev/add-ins/outlook/understanding-outlook-add-in-permissions | Minimum permission level}**: **read item**
15435+
*
15436+
* **{@link https://learn.microsoft.com/office/dev/add-ins/outlook/outlook-add-ins-overview#extension-points | Applicable Outlook mode}**: Compose or Read
15437+
*
15438+
* **Important**: Legacy Exchange Online user identity tokens and callback tokens are no longer supported and are turned off across all Microsoft 365 tenants.
15439+
* If an Outlook add-in requires delegated user access or user identity, we recommend using MSAL (Microsoft Authentication Library) and nested app authentication (NAA).
15440+
* Exchange user identity tokens are still supported for Exchange on-premises. For more information, see
15441+
* {@link https://learn.microsoft.com/office/dev/add-ins/outlook/faq-nested-app-auth-outlook-legacy-tokens | Nested app authentication FAQ}.
15442+
*
15443+
* @beta
15444+
*/
15445+
interface Ews {
15446+
/**
15447+
* Gets the status of EWS callback tokens in an organization.
15448+
*
15449+
* @remarks
15450+
*
15451+
* [Api set: Mailbox preview]
15452+
*
15453+
* **{@link https://learn.microsoft.com/office/dev/add-ins/outlook/understanding-outlook-add-in-permissions | Minimum permission level}**: **read item**
15454+
*
15455+
* **{@link https://learn.microsoft.com/office/dev/add-ins/outlook/outlook-add-ins-overview#extension-points | Applicable Outlook mode}**: Compose or Read
15456+
*
15457+
* **Important**:
15458+
*
15459+
* - The `getTokenStatusAsync` method is available for preview in Outlook on the web and on Windows (new and classic (Version 2510, Build 19328.20000 and later)).
15460+
*
15461+
* - The `getTokenStatusAsync` method isn't supported if you load an add-in in an Outlook.com or Gmail mailbox.
15462+
*
15463+
* - Calling the `getTokenStatusAsync` method in compose mode requires you to have saved the item. The `saveAsync` method requires a minimum permission level of **read/write item**.
15464+
*
15465+
* @param options - An object literal that contains one or more of the following properties. `asyncContext`: Any data you want to access in the callback function.
15466+
* `isRest`: Identifies whether the token needed is for EWS or Outlook REST APIs. By default, the `isRest` property is set to `false`.
15467+
* @param callback - When the method completes, the function passed in the `callback` parameter is called with a single parameter of type Office.AsyncResult.
15468+
* The `asyncResult.value` property returns the token status, which can be `Office.MailboxEnums.TokenStatus.Enabled`, `Office.MailboxEnums.TokenStatus.Disabled`, or
15469+
* `Office.MailboxEnums.TokenStatus.Removed`. A `Office.MailboxEnums.TokenStatus.Removed` status indicates that the mailbox is hosted in an Exchange Online environment
15470+
* where legacy Exchange tokens are turned off and are no longer supported.
15471+
*
15472+
* @beta
15473+
*/
15474+
getTokenStatusAsync(options: Office.AsyncContextOptions & { isRest?: boolean }, callback: (asyncResult: Office.AsyncResult<MailboxEnums.TokenStatus>) => void): void;
15475+
/**
15476+
* Gets the status of EWS callback tokens in an organization.
15477+
*
15478+
* @remarks
15479+
*
15480+
* [Api set: Mailbox preview]
15481+
*
15482+
* **{@link https://learn.microsoft.com/office/dev/add-ins/outlook/understanding-outlook-add-in-permissions | Minimum permission level}**: **read item**
15483+
*
15484+
* **{@link https://learn.microsoft.com/office/dev/add-ins/outlook/outlook-add-ins-overview#extension-points | Applicable Outlook mode}**: Compose or Read
15485+
*
15486+
* **Important**:
15487+
*
15488+
* - The `getTokenStatusAsync` method is available for preview in Outlook on the web and on Windows (new and classic (Version 2510, Build 19328.20000 and later)).
15489+
*
15490+
* - The `getTokenStatusAsync` method isn't supported if you load an add-in in an Outlook.com or Gmail mailbox.
15491+
*
15492+
* - Calling the `getTokenStatusAsync` method in compose mode requires you to have saved the item. The `saveAsync` method requires a minimum permission level of **read/write item**.
15493+
*
15494+
* @param callback - When the method completes, the function passed in the `callback` parameter is called with a single parameter of type Office.AsyncResult.
15495+
* The `asyncResult.value` property returns the token status, which can be `Office.MailboxEnums.TokenStatus.Enabled`, `Office.MailboxEnums.TokenStatus.Disabled`, or
15496+
* `Office.MailboxEnums.TokenStatus.Removed`. A `Office.MailboxEnums.TokenStatus.Removed` status indicates that the mailbox is hosted in an Exchange Online environment
15497+
* where legacy Exchange tokens are turned off and are no longer supported.
15498+
*
15499+
* @beta
15500+
*/
15501+
getTokenStatusAsync(callback: (asyncResult: Office.AsyncResult<MailboxEnums.TokenStatus>) => void): void;
15502+
}
1537515503
/**
1537615504
* Provides a method to get the from value of a message in an Outlook add-in.
1537715505
*
@@ -18536,6 +18664,9 @@ declare namespace Office {
1853618664
* add-ins to use {@link https://learn.microsoft.com/outlook/rest#outlook-rest-api-via-microsoft-graph | Microsoft Graph}. For guidance, see
1853718665
* {@link https://learn.microsoft.com/outlook/rest/compare-graph | Compare Microsoft Graph and Outlook REST API endpoints}.
1853818666
*
18667+
* - To determine if REST or EWS tokens are available in an organization, call `Office.context.mailbox.diagnostics.ews.getTokenStatusAsync`.
18668+
* The `getTokenStatusAsync` method is available for preview in Outlook on the web and on Windows (new and classic (Version 2510, Build 19328.20000 and later)).
18669+
*
1853918670
* - This method isn't supported if you load an add-in in an Outlook.com or Gmail mailbox.
1854018671
*
1854118672
* - This method is only supported in read mode in Outlook on Android and on iOS. For more information on supported APIs in Outlook mobile, see
@@ -18640,6 +18771,9 @@ declare namespace Office {
1864018771
* attachment or item. For example, you can create a remote service to
1864118772
* {@link https://learn.microsoft.com/office/dev/add-ins/outlook/get-attachments-of-an-outlook-item | get attachments from the selected item}.
1864218773
*
18774+
* - To determine if REST or EWS tokens are available in an organization, call `Office.context.mailbox.diagnostics.ews.getTokenStatusAsync`.
18775+
* The `getTokenStatusAsync` method is available for preview in Outlook on the web and on Windows (new and classic (Version 2510, Build 19328.20000 and later)).
18776+
*
1864318777
* - Calling the `getCallbackTokenAsync` method in read mode requires a minimum permission level of **read item**.
1864418778
*
1864518779
* - Calling the `getCallbackTokenAsync` method in compose mode requires you to have saved the item.

0 commit comments

Comments
 (0)