Office.SensitivityLabelsCatalog interface

Provides methods to check the status of the catalog of sensitivity labels in Outlook and retrieve all available sensitivity labels if the catalog is enabled.

Remarks

[ API set: Mailbox 1.13 ]

Minimum permission level: read/write item

Applicable Outlook mode: Compose

Important: To use the sensitivity label feature in your add-in, you must have a Microsoft 365 E5 subscription.

To learn more about how to manage sensitivity labels in your add-in, see Manage the sensitivity label of your message or appointment in compose mode.

Methods

getAsync(options, callback)

Gets all the sensitivity labels that are enabled in Outlook.

getAsync(callback)

Gets all the sensitivity labels that are enabled in Outlook.

getIsEnabledAsync(options, callback)

Checks whether the catalog of sensitivity labels is enabled in Outlook.

getIsEnabledAsync(callback)

Checks whether the catalog of sensitivity labels is enabled in Outlook.

Method Details

getAsync(options, callback)

Gets all the sensitivity labels that are enabled in Outlook.

getAsync(options: Office.AsyncContextOptions, callback: (asyncResult: Office.AsyncResult<SensitivityLabelDetails[]>) => void): void;

Parameters

options
Office.AsyncContextOptions

An object literal that contains one or more of the following properties:- asyncContext: Developers can provide any object they wish to access in the callback function.

callback

(asyncResult: Office.AsyncResult<Office.SensitivityLabelDetails[]>) => void

When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an Office.AsyncResult object. The available sensitivity labels and their properties are returned in the asyncResult.value property.

Returns

void

Remarks

[ API set: Mailbox 1.13 ]

Minimum permission level: read/write item

Applicable Outlook mode: Compose

Important: To use the sensitivity label feature in your add-in, you must have a Microsoft 365 E5 subscription.

Recommended: To determine whether the catalog of sensitivity labels is enabled in Outlook, call getIsEnabledAsync before using getAsync.

To learn more about how to manage sensitivity labels in your add-in, see Manage the sensitivity label of your message or appointment in compose mode.

getAsync(callback)

Gets all the sensitivity labels that are enabled in Outlook.

getAsync(callback: (asyncResult: Office.AsyncResult<SensitivityLabelDetails[]>) => void): void;

Parameters

callback

(asyncResult: Office.AsyncResult<Office.SensitivityLabelDetails[]>) => void

When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an Office.AsyncResult object. The available sensitivity labels and their properties are returned in the asyncResult.value property.

Returns

void

Remarks

[ API set: Mailbox 1.13 ]

Minimum permission level: read/write item

Applicable Outlook mode: Compose

Important: To use the sensitivity label feature in your add-in, you must have a Microsoft 365 E5 subscription.

Recommended: To determine whether the catalog of sensitivity labels is enabled in Outlook, call getIsEnabledAsync before using getAsync.

To learn more about how to manage sensitivity labels in your add-in, see Manage the sensitivity label of your message or appointment in compose mode.

Examples

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/60-sensitivity-label/sensitivity-labels-catalog.yaml

// 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);
  }
});

getIsEnabledAsync(options, callback)

Checks whether the catalog of sensitivity labels is enabled in Outlook.

getIsEnabledAsync(options: Office.AsyncContextOptions, callback: (asyncResult: Office.AsyncResult<boolean>) => void): void;

Parameters

options
Office.AsyncContextOptions

An object literal that contains one or more of the following properties:- asyncContext: Developers can provide any object they wish to access in the callback function.

callback

(asyncResult: Office.AsyncResult<boolean>) => void

When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an Office.AsyncResult object. The status of the catalog of sensitivity labels is returned in the asyncResult.value property.

Returns

void

Remarks

[ API set: Mailbox 1.13 ]

Minimum permission level: read/write item

Applicable Outlook mode: Compose

Important: The catalog of sensitivity labels is configured by an organization's administrator. For more information, see Get started with sensitivity labels.

Important: To use the sensitivity label feature in your add-in, you must have a Microsoft 365 E5 subscription.

To learn more about how to manage sensitivity labels in your add-in, see Manage the sensitivity label of your message or appointment in compose mode.

getIsEnabledAsync(callback)

Checks whether the catalog of sensitivity labels is enabled in Outlook.

getIsEnabledAsync(callback: (asyncResult: Office.AsyncResult<boolean>) => void): void;

Parameters

callback

(asyncResult: Office.AsyncResult<boolean>) => void

When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an Office.AsyncResult object. The status of the catalog of sensitivity labels is returned in the asyncResult.value property.

Returns

void

Remarks

[ API set: Mailbox 1.13 ]

Minimum permission level: read/write item

Applicable Outlook mode: Compose

Important: The catalog of sensitivity labels is configured by an organization's administrator. For more information, see Get started with sensitivity labels.

Important: To use the sensitivity label feature in your add-in, you must have a Microsoft 365 E5 subscription.

To learn more about how to manage sensitivity labels in your add-in, see Manage the sensitivity label of your message or appointment in compose mode.

Examples

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/60-sensitivity-label/sensitivity-labels-catalog.yaml

// 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);
  }
});