Created
July 28, 2023 08:17
-
-
Save Arikael/b88dd54074988f0b9a64e46fdcf7d913 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: rfc5322 | |
description: '' | |
host: OUTLOOK | |
api_set: {} | |
script: | |
content: > | |
$("#set-custom-headers").click(setCustomHeaders); | |
$("#get-selected-custom-headers").click(getSelectedCustomHeaders); | |
$("#remove-selected-custom-headers").click(removeSelectedCustomHeaders); | |
var data = | |
' my-type="urn:my:test:which:is:longer:than:998:1:0";\r\n' + | |
' my-param*0="PG1iOadpbmRpbmdJbmZvcm1hdGlvbiB4bWxuczp4c2k9Imh0dH";\r\n' + | |
' my-param*1="A6Ly93d3cudzMub3JnLzIwMDEvWE1MU2NoZW1hLWluc3RhbmNl";\r\n' + | |
' my-param*2="IiB4bWxdfgg4c2Q9Imh0dHA6Ly93d3cudzMub3JnLzIwMDEvWE";\r\n' + | |
' my-param*3="1MU2NoZW1hIiB4bWxuczpkcz0iaHR0cDovL3d3dy53My5vcmcv";\r\n' + | |
' my-param*4="MjAwMC8wOS94bWxkc2lnIyIgeG1sbnM6eG1pbWU9Imh0dHA6Ly";\r\n' + | |
' my-param*5="93d3cudzMub3JnLzIwMDUvMDUveG1sbWltZSIgeG1sbnM6bWI9";\r\n' + | |
' my-param*6="InVybjpuYXR934dfgfdhZzo0Nzc4OmJpbmRpbmdpbmZvcm1hdG";\r\n' + | |
' my-param*7="lvbjoxOjAiPjxtYjpNZXRhZGF0YUJpbmRpbmdDb250YWluZXI+";\r\n' + | |
' my-param*8="PG1iOk1ldGFkYXRhQmluZGluZz48bWI6TWV0YWRhdGE+PHNsYW";\r\n' + | |
' my-param*9="I6b3JpZ2luYXRvckNvbmZpZGVudGlhbGl0eUxhYmVsIHhtbG5z";\r\n' + | |
' my-param*10="OnNsYWI9InVybjpuYXRvOnN0YW5hZzo0Nzc0OmNvbmZpZGVudG";\r\n' + | |
' my-param*11="lhbGl0eW1ldGdfgfdgfdagfdaggTowIj48c2xhYjpDb25maWRl";\r\n' + | |
' my-param*12="lhbGl0eW1ldGdfgfdgfdagfdaggTowIj48c2xhYjpDb25maWRl";\r\n' + | |
' my-param*13="lhbGl0eW1ldGdfgfdgfdagfdaggTowIj48c2xhYjpDb25maWRl";\r\n' + | |
' my-param*14="lhbGl0eW1ldGdfgfdgfdagfdaggTowIj48c2xhYjpDb25maWRl";\r\n' + | |
' my-param*15="lh1sdffW1ldGFkYXRhbGFiZWw6MTowIj48c2xhYjpDb25maWRl";\r\n'; | |
// Set custom internet headers. | |
function setCustomHeaders() { | |
console.log("start"); | |
Office.context.mailbox.item.internetHeaders.setAsync({ "my-header": data }, function(asyncResult) { | |
if (asyncResult.status === Office.AsyncResultStatus.Succeeded) { | |
console.log("Successfully set headers"); | |
} else { | |
console.log("Error setting headers: " + JSON.stringify(asyncResult.error)); | |
} | |
}); | |
} | |
// Get custom internet headers. | |
function getSelectedCustomHeaders() { | |
Office.context.mailbox.item.internetHeaders.getAsync(["my-header"], function(asyncResult) { | |
if (asyncResult.status === Office.AsyncResultStatus.Succeeded) { | |
console.log("Selected headers: " + JSON.stringify(asyncResult.value)); | |
} else { | |
console.log("Error getting selected headers: " + JSON.stringify(asyncResult.error)); | |
} | |
}); | |
} | |
// Remove custom internet headers. | |
function removeSelectedCustomHeaders() { | |
Office.context.mailbox.item.internetHeaders.removeAsync(["best-vegetable", "nonexistent-header"], function( | |
asyncResult | |
) { | |
if (asyncResult.status === Office.AsyncResultStatus.Succeeded) { | |
console.log("Successfully removed selected headers"); | |
} else { | |
console.log("Error removing selected headers: " + JSON.stringify(asyncResult.error)); | |
} | |
}); | |
} | |
/* Sample output: | |
Successfully set headers | |
Selected headers: | |
{"best-vegetable":"spinach","preferred-fruit":"orange","preferred-vegetable":"broccoli"} | |
Successfully removed selected headers | |
Selected headers: | |
{"preferred-fruit":"orange","preferred-vegetable":"broccoli"} | |
*/ | |
language: typescript | |
template: | |
content: |- | |
<button id="set-custom-headers" class="ms-Button"> | |
<span class="ms-Button-label">Run</span> | |
</button> | |
<button id="get-selected-custom-headers" class="ms-Button"> | |
<span class="ms-Button-label">Get</span> | |
</button> | |
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