Created
January 25, 2024 05:11
-
-
Save rajeshthakur1976/04ce7702ebf3a2359e92e4a1fd0be2bd to your computer and use it in GitHub Desktop.
Gets the selected text in the item body or subject in Compose mode.
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: Get selected text (Compose) | |
description: Gets the selected text in the item body or subject in Compose mode. | |
host: OUTLOOK | |
api_set: {} | |
script: | |
content: | | |
$("#get-selected-data").click(getSelectedData); | |
function getSelectedData() { | |
Office.context.mailbox.item.getSelectedDataAsync(Office.CoercionType.Text, function(asyncResult) { | |
if (asyncResult.status === Office.AsyncResultStatus.Succeeded) { | |
const text = asyncResult.value.data; | |
const prop = asyncResult.value.sourceProperty; | |
console.log("Selected text ind " + prop + ": " + text); | |
} else { | |
console.error(asyncResult.error); | |
} | |
}); | |
} | |
language: typescript | |
template: | |
content: "<section class=\"ms-font-m\">\n\t<p class=\"ms-font-m\">This sample shows how to get the selected text in the item body or subject/title.</p>\n\t<p><b>Required mode</b>: Compose</p>\n</section>\n\n<section class=\"samples ms-font-m\">\n\t<h3>Try it out</h3>\n\t<p>Select text in the item body or subject then push the <b>Get selected text</b> button.</p>\n\t<button id=\"get-selected-data\" class=\"ms-Button\">\n <span class=\"ms-Button-label\">Get selected text</span>\n </button>\n</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 | |
[email protected]/dist/css/fabric.min.css | |
[email protected]/dist/css/fabric.components.min.css | |
[email protected]/client/core.min.js | |
@types/core-js | |
[email protected] | |
@types/[email protected] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment