Word.SensitivityLabelUpdateResult interface

注意

此 API 以预览状态提供给开发者,可能根据我们收到的反馈更改。 请勿在生产环境中使用此 API。

表示尝试更新文档上的敏感度标签的结果。

注解

API 集:WordApi BETA (仅预览版)

使用方

示例

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/word/99-preview-apis/manage-sensitivity-labels.yaml

// Apply the selected sensitivity label to the document.
await Word.run(async (context) => {
  const labelId = (document.getElementById("label-id") as HTMLSelectElement).value;
  if (!labelId) {
    console.warn("Get the available labels, and then select a label to apply.");
    return;
  }

  const wordDocument: Word.Document = context.document;
  const documentLabel: Word.SensitivityLabel = wordDocument.sensitivityLabel;

  const updateResult: OfficeExtension.ClientResult<Word.SensitivityLabelUpdateResult> =
    documentLabel.tryToUpdate(labelId);
  await context.sync();

  if (updateResult.value.status === Word.SensitivityLabelUpdateStatus.success) {
    console.log("Applied the sensitivity label to the document.");
  } else {
    console.error(`The sensitivity label wasn't applied. Status: ${updateResult.value.status}`);
  }
});

属性

status

获取更新尝试的结果状态。

属性详细信息

status

注意

此 API 以预览状态提供给开发者,可能根据我们收到的反馈更改。 请勿在生产环境中使用此 API。

获取更新尝试的结果状态。

status: Word.SensitivityLabelUpdateStatus | "Success" | "UnspecifiedFailure" | "LabelNotFound" | "DocumentReadOnly" | "InsufficientPermission" | "UnsupportedDoubleKeyEncryption" | "LabelingDisabled" | "UserNotFound" | "UnsupportedUdp" | "ParentLabelNotSupported" | "CrossTenant" | "AbacAttributesNotAllowed" | "AbacAttributesRequired" | "UnsupportedAbac" | "LabelDisabled" | "RemovingLabelNotSupported";

属性值

Word.SensitivityLabelUpdateStatus | "Success" | "UnspecifiedFailure" | "LabelNotFound" | "DocumentReadOnly" | "InsufficientPermission" | "UnsupportedDoubleKeyEncryption" | "LabelingDisabled" | "UserNotFound" | "UnsupportedUdp" | "ParentLabelNotSupported" | "CrossTenant" | "AbacAttributesNotAllowed" | "AbacAttributesRequired" | "UnsupportedAbac" | "LabelDisabled" | "RemovingLabelNotSupported"

注解

API 集:WordApi BETA (仅预览版)