diff --git a/playlists-prod/outlook.yaml b/playlists-prod/outlook.yaml index 9a1b827b..3aa483dc 100644 --- a/playlists-prod/outlook.yaml +++ b/playlists-prod/outlook.yaml @@ -830,6 +830,17 @@ group: Preview APIs api_set: Mailbox: preview +- id: outlook-get-token-status + name: Get the status of EWS tokens in an organization + fileName: get-token-status.yaml + description: >- + Gets the status of Exchange Web Services (EWS) callback tokens in an + organization. + rawUrl: >- + https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/99-preview-apis/get-token-status.yaml + group: Preview APIs + api_set: + Mailbox: preview - id: outlook-set-displayed-body-subject name: Temporarily set the body or subject displayed in a message (Message Read) fileName: set-displayed-body-subject.yaml diff --git a/playlists/outlook.yaml b/playlists/outlook.yaml index 557b89f9..9b8f1814 100644 --- a/playlists/outlook.yaml +++ b/playlists/outlook.yaml @@ -830,6 +830,17 @@ group: Preview APIs api_set: Mailbox: preview +- id: outlook-get-token-status + name: Get the status of EWS tokens in an organization + fileName: get-token-status.yaml + description: >- + Gets the status of Exchange Web Services (EWS) callback tokens in an + organization. + rawUrl: >- + https://raw.githubusercontent.com/OfficeDev/office-js-snippets/main/samples/outlook/99-preview-apis/get-token-status.yaml + group: Preview APIs + api_set: + Mailbox: preview - id: outlook-set-displayed-body-subject name: Temporarily set the body or subject displayed in a message (Message Read) fileName: set-displayed-body-subject.yaml diff --git a/samples/outlook/99-preview-apis/get-token-status.yaml b/samples/outlook/99-preview-apis/get-token-status.yaml new file mode 100644 index 00000000..488c867f --- /dev/null +++ b/samples/outlook/99-preview-apis/get-token-status.yaml @@ -0,0 +1,114 @@ +order: 2 +id: outlook-get-token-status +name: Get the status of EWS tokens in an organization +description: Gets the status of Exchange Web Services (EWS) callback tokens in an organization. +host: OUTLOOK +api_set: + Mailbox: preview +script: + content: | + document.getElementById("get-status").addEventListener("click", + getTokenStatus); + + function getTokenStatus() { + 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; + } + }); + } + language: typescript +template: + content: |- +
+

This sample shows how to determine if Exchange Web Services (EWS) callback tokens are supported in an + organization. +

+

Supported Outlook clients: Web and Windows (new and classic (Version 2510, Build 19328.20000 or later))

+

+ Required mode: Compose or Read +

+
+
+

Try it out

+ +
+ language: html +style: + content: |- + body { + font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; + font-size: 14px; + line-height: 1.5; + padding: 10px; + } + + section { + margin-bottom: 20px; + } + + h3 { + margin-top: 0; + margin-bottom: 10px; + font-size: 16px; + } + + p { + margin: 0 0 10px 0; + } + + button { + background-color: #0078d4; + color: white; + border: none; + padding: 8px 16px; + font-size: 14px; + cursor: pointer; + border-radius: 2px; + margin-left: 20px; + margin-bottom: 5px; + min-width: 80px; + display: block; + } + + button:hover { + background-color: #106ebe; + } + + button:active { + background-color: #005a9e; + } + + input { + padding: 8px; + margin: 5px 0; + border: 1px solid #ccc; + border-radius: 2px; + font-size: 14px; + } + + .header { + text-align: center; + background-color: #f3f2f1; + padding: 10px; + } + language: css +libraries: |- + https://appsforoffice.microsoft.com/lib/beta/hosted/office.js + https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/master/types/office-js-preview/index.d.ts \ No newline at end of file diff --git a/view-prod/outlook.json b/view-prod/outlook.json index 3eeda67d..2b044b70 100644 --- a/view-prod/outlook.json +++ b/view-prod/outlook.json @@ -86,5 +86,6 @@ "outlook-send-async": "https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/90-other-item-apis/send-async.yaml", "outlook-other-item-apis-get-loaded-message-properties": "https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/90-other-item-apis/get-loaded-message-properties.yaml", "outlook-get-set-isalldayevent": "https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/99-preview-apis/get-set-isalldayevent.yaml", + "outlook-get-token-status": "https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/99-preview-apis/get-token-status.yaml", "outlook-set-displayed-body-subject": "https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/99-preview-apis/set-displayed-body-subject.yaml" } \ No newline at end of file diff --git a/view/outlook.json b/view/outlook.json index 6e7f14ee..0a280d71 100644 --- a/view/outlook.json +++ b/view/outlook.json @@ -86,5 +86,6 @@ "outlook-send-async": "https://raw.githubusercontent.com/OfficeDev/office-js-snippets/main/samples/outlook/90-other-item-apis/send-async.yaml", "outlook-other-item-apis-get-loaded-message-properties": "https://raw.githubusercontent.com/OfficeDev/office-js-snippets/main/samples/outlook/90-other-item-apis/get-loaded-message-properties.yaml", "outlook-get-set-isalldayevent": "https://raw.githubusercontent.com/OfficeDev/office-js-snippets/main/samples/outlook/99-preview-apis/get-set-isalldayevent.yaml", + "outlook-get-token-status": "https://raw.githubusercontent.com/OfficeDev/office-js-snippets/main/samples/outlook/99-preview-apis/get-token-status.yaml", "outlook-set-displayed-body-subject": "https://raw.githubusercontent.com/OfficeDev/office-js-snippets/main/samples/outlook/99-preview-apis/set-displayed-body-subject.yaml" } \ No newline at end of file