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..7938cbf1 --- /dev/null +++ b/samples/outlook/99-preview-apis/get-token-status.yaml @@ -0,0 +1,70 @@ +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((result) => { + if (result.status === Office.AsyncResultStatus.Failed) { + console.log(result.error.message); + return; + } + + const status = result.value; + switch (status) { + case 0: + console.log("EWS callback tokens are enabled."); + break; + case 1: + console.log("EWS callback tokens are disabled."); + break; + case 2: + 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. +

+ Required mode: Compose or Read +

+

+
+
+

Try it out

+ +
+ language: html +style: + content: |- + section.samples { + margin-top: 20px; + } + + section.samples .ms-Button, section.setup .ms-Button { + display: block; + margin-bottom: 5px; + margin-left: 20px; + min-width: 80px; + } + 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 + + https://unpkg.com/office-ui-fabric-core@11.1.0/dist/css/fabric.min.css + https://unpkg.com/office-ui-fabric-js@1.5.0/dist/css/fabric.components.min.css \ 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