Office.SensitivityLabelsCatalog interface

提供方法来检查 Outlook 中敏感度标签目录的状态,并在启用目录的情况下检索所有可用的敏感度标签。

注解

API 集:邮箱 1.13

最低权限级别读取/写入项目

适用的 Outlook 模式:Compose

重要提示: 若要在加载项中使用敏感度标签功能,必须具有 Microsoft 365 E5 订阅。

若要详细了解如何在加载项中管理敏感度标签,请参阅 在撰写模式下管理邮件或约会的敏感度标签

使用方

方法

getAsync(options, callback)

获取 Outlook 中启用的所有敏感度标签。

getAsync(callback)

获取 Outlook 中启用的所有敏感度标签。

getIsEnabledAsync(options, callback)

检查是否已在 Outlook 中启用敏感度标签目录。

getIsEnabledAsync(callback)

检查是否已在 Outlook 中启用敏感度标签目录。

方法详细信息

getAsync(options, callback)

获取 Outlook 中启用的所有敏感度标签。

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

参数

options
Office.AsyncContextOptions

包含以下一个或多个属性的对象文本:- asyncContext:开发人员可以在回调函数中提供他们希望访问的任何对象。

callback

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

当该方法完成时,将使用单个参数(一个对象)asyncResultOffice.AsyncResult调用传入参数的callback函数。 属性中 asyncResult.value 会返回可用的敏感度标签及其属性。

返回

void

注解

API 集:邮箱 1.13

最低权限级别读取/写入项目

适用的 Outlook 模式:Compose

重要提示: 若要在加载项中使用敏感度标签功能,必须具有 Microsoft 365 E5 订阅。

建议:若要确定是否在 Outlook 中启用了敏感度标签目录,请在使用getAsync之前调用getIsEnabledAsync

若要详细了解如何在加载项中管理敏感度标签,请参阅 在撰写模式下管理邮件或约会的敏感度标签

getAsync(callback)

获取 Outlook 中启用的所有敏感度标签。

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

参数

callback

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

当该方法完成时,将使用单个参数(一个对象)asyncResultOffice.AsyncResult调用传入参数的callback函数。 属性中 asyncResult.value 会返回可用的敏感度标签及其属性。

返回

void

注解

API 集:邮箱 1.13

最低权限级别读取/写入项目

适用的 Outlook 模式:Compose

重要提示: 若要在加载项中使用敏感度标签功能,必须具有 Microsoft 365 E5 订阅。

建议:若要确定是否在 Outlook 中启用了敏感度标签目录,请在使用getAsync之前调用getIsEnabledAsync

若要详细了解如何在加载项中管理敏感度标签,请参阅 在撰写模式下管理邮件或约会的敏感度标签

示例

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

检查是否已在 Outlook 中启用敏感度标签目录。

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

参数

options
Office.AsyncContextOptions

包含以下一个或多个属性的对象文本:- asyncContext:开发人员可以在回调函数中提供他们希望访问的任何对象。

callback

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

当该方法完成时,将使用单个参数(一个对象)asyncResultOffice.AsyncResult调用传入参数的callback函数。 在属性中 asyncResult.value 返回敏感度标签目录的状态。

返回

void

注解

API 集:邮箱 1.13

最低权限级别读取/写入项目

适用的 Outlook 模式:Compose

重要提示: 敏感度标签目录由组织的管理员配置。 有关详细信息,请参阅 敏感度标签入门。

重要提示: 若要在加载项中使用敏感度标签功能,必须具有 Microsoft 365 E5 订阅。

若要详细了解如何在加载项中管理敏感度标签,请参阅 在撰写模式下管理邮件或约会的敏感度标签

getIsEnabledAsync(callback)

检查是否已在 Outlook 中启用敏感度标签目录。

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

参数

callback

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

当该方法完成时,将使用单个参数(一个对象)asyncResultOffice.AsyncResult调用传入参数的callback函数。 在属性中 asyncResult.value 返回敏感度标签目录的状态。

返回

void

注解

API 集:邮箱 1.13

最低权限级别读取/写入项目

适用的 Outlook 模式:Compose

重要提示: 敏感度标签目录由组织的管理员配置。 有关详细信息,请参阅 敏感度标签入门。

重要提示: 若要在加载项中使用敏感度标签功能,必须具有 Microsoft 365 E5 订阅。

若要详细了解如何在加载项中管理敏感度标签,请参阅 在撰写模式下管理邮件或约会的敏感度标签

示例

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