order: 1 id: outlook-sensitivity-labels-sensitivity-labels-catalog name: Work with the sensitivity labels catalog description: Determines if sensitivity labels are enabled on the mailbox and retrieves all available labels from the catalog. host: OUTLOOK api_set: Mailbox: '1.13' script: content: |- document.getElementById("get-sensitivity-labels-enabled").addEventListener("click", getSensitivityLabelsCatalogIsEnabled); document.getElementById("get-sensitivity-labels-catalog").addEventListener("click", getSensitivityLabelsCatalog); function getSensitivityLabelsCatalogIsEnabled() { // This snippet determines if the sensitivity labels catalog is enabled on the current mailbox. Office.context.sensitivityLabelsCatalog.getIsEnabledAsync((asyncResult) => { if (asyncResult.status === Office.AsyncResultStatus.Succeeded) { console.log(asyncResult.value); } else { console.log("Action failed with error: " + asyncResult.error.message); } }); } function getSensitivityLabelsCatalog() { // This snippet gets all available sensitivity labels from the catalog. Office.context.sensitivityLabelsCatalog.getIsEnabledAsync((asyncResult) => { if (asyncResult.status === Office.AsyncResultStatus.Succeeded && asyncResult.value == true) { Office.context.sensitivityLabelsCatalog.getAsync((asyncResult) => { if (asyncResult.status === Office.AsyncResultStatus.Succeeded) { const catalog = asyncResult.value; console.log("Sensitivity Labels Catalog:"); console.log(JSON.stringify(catalog)); } else { console.log("Action failed with error: " + asyncResult.error.message); } }); } else { console.log("Action failed with error: " + asyncResult.error.message); } }); } language: typescript template: content: |-

This sample shows how to determine if sensitivity labels are enabled on the mailbox and retrieves all available labels from the catalog. To learn more about the sensitivity label API, see Manage the sensitivity label of your message or appointment in compose mode.

Required mode: Compose

Try it out

language: html style: content: |- body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; font-size: 14px; line-height: 1.5; padding: 10px; } section { margin-bottom: 20px; } h3 { margin-top: 0; margin-bottom: 10px; font-size: 16px; } p { margin: 0 0 10px 0; } button { background-color: #f0f0f0; color: #333333; border: 1px solid #8a8a8a; padding: 8px 16px; font-size: 14px; cursor: pointer; border-radius: 2px; margin-left: 20px; margin-bottom: 5px; min-width: 80px; display: block; } button:hover { background-color: #e0e0e0; } button:active { background-color: #d0d0d0; } input { padding: 8px; margin: 5px 0; border: 1px solid #ccc; border-radius: 2px; font-size: 14px; } .header { text-align: center; background-color: #f3f2f1; padding: 10px; } language: css libraries: |- https://officeapis.public.onecdn.static.microsoft/1/office.js https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/master/types/office-js/index.d.ts