Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save JuaneloJuanelo/943b0e2264ce39d52bc101ca47e3f1d5 to your computer and use it in GitHub Desktop.
Save JuaneloJuanelo/943b0e2264ce39d52bc101ca47e3f1d5 to your computer and use it in GitHub Desktop.
Gets a message using EWS without any back-end code.
name: Get a message using EWS
description: Gets a message using EWS without any back-end code.
host: OUTLOOK
api_set: {}
script:
content: |
$("#run").click(run);
function run() {
const ewsId = Office.context.mailbox.item.itemId;
console.log(ewsId);
const request =
'<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">' +
' <soap:Header><t:RequestServerVersion Version="Exchange2013" /></soap:Header>' +
" <soap:Body>" +
" <m:GetItem>" +
" <m:ItemShape>" +
" <t:BaseShape>IdOnly</t:BaseShape>" +
" </m:ItemShape >" +
" <m:ItemIds>" +
' <t:ItemId Id="' +
ewsId +
'" />' +
" </m:ItemIds>" +
" </m:GetItem>" +
" </soap:Body>" +
"</soap:Envelope>";
Office.context.mailbox.makeEwsRequestAsync(request, function(result) {
console.log(result);
});
}
language: typescript
template:
content: |
<section class="ms-font-m">
<p>This sample shows how to get a message using EWS, without any back-end code.</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