Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mukowman/95179dd2dce088403d5a2ed7ed6830f6 to your computer and use it in GitHub Desktop.
Save mukowman/95179dd2dce088403d5a2ed7ed6830f6 to your computer and use it in GitHub Desktop.
Retrieves and displays REST and EWS endpoint URLs and item IDs, and converts item IDs for different protocols.
name: Endpoint URLs and item IDs
description: >-
Retrieves and displays REST and EWS endpoint URLs and item IDs, and converts
item IDs for different protocols.
host: OUTLOOK
api_set: {}
script:
content: |
$("#run").click(run);
function run() {
console.log("EWS URL: " + Office.context.mailbox.ewsUrl);
var ewsId = Office.context.mailbox.item.itemId;
console.log("EWS item ID: " + Office.context.mailbox.item.itemId);
console.log("REST URL: " + Office.context.mailbox.restUrl);
var restId = Office.context.mailbox.convertToRestId(ewsId, Office.MailboxEnums.RestVersion.v2_0);
console.log("REST item ID: " + restId);
var ewsId2 = Office.context.mailbox.convertToEwsId(restId, Office.MailboxEnums.RestVersion.v2_0);
console.log("EWS ID (from REST ID): " + ewsId2);
}
language: typescript
template:
content: |
<section class="ms-font-m">
<p>This sample shows how to retrieve REST and EWS endpoint URLs and item IDs, and convert item IDs for different protocols.</p>
</section>
<section class="samples ms-font-m">
<h3>Try it out</h3>
<button id="run" class="ms-Button">
<div class="ms-Button-label">Run</div>
</button>
</section>
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/1/hosted/office.js
@types/office-js
office-ui-fabric-js@1.4.0/dist/css/fabric.min.css
office-ui-fabric-js@1.4.0/dist/css/fabric.components.min.css
core-js@2.4.1/client/core.min.js
@types/core-js
jquery@3.1.1
@types/jquery@3.3.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment