Office.MailboxEnums.TokenStatus enum
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Specifies the status of Exchange Web Services (EWS) callback tokens or REST API tokens in an organization.
Remarks
Applicable Outlook mode: Compose or Read
Important: Legacy Exchange Online user identity tokens and callback tokens are no longer supported and are turned off across all Microsoft 365 tenants. If an Outlook add-in requires delegated user access or user identity, we recommend using MSAL (Microsoft Authentication Library) and nested app authentication (NAA). Exchange user identity tokens are still supported for Exchange on-premises. For more information, see Nested app authentication FAQ.
Examples
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/99-preview-apis/get-token-status.yaml
Office.context.mailbox.diagnostics.ews.getTokenStatusAsync({ isRest: false }, (result) => {
if (result.status === Office.AsyncResultStatus.Failed) {
console.log(result.error.message);
return;
}
const status = result.value;
switch (status) {
case Office.MailboxEnums.TokenStatus.Enabled:
console.log("EWS callback tokens are enabled.");
break;
case Office.MailboxEnums.TokenStatus.Disabled:
console.log("EWS callback tokens are disabled.");
break;
case Office.MailboxEnums.TokenStatus.Removed:
console.log(
"The organization has an Exchange Online environment. Legacy Exchange tokens are no longer supported.",
);
break;
}
});
Fields
| Disabled = 0 | EWS callback tokens or REST API tokens are turned off in the organization. |
| Enabled = 1 | EWS callback tokens or REST API tokens are supported in the organization. |
| Removed = 2 | The mailbox is hosted in an Exchange Online environment where EWS tokens are turned off and are no longer supported. |