Word.SensitivityLabelUpdateStatus enum

注意

此 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}`);
  }
});

字段

abacAttributesNotAllowed = "AbacAttributesNotAllowed"

基于属性的访问控制 (ABAC) 提供了属性值,但目标标签未启用 ABAC。

abacAttributesRequired = "AbacAttributesRequired"

目标标签已启用 (ABAC) 的基于属性的访问控制,并且需要选择属性,但未提供 ABAC 属性值。

crossTenant = "CrossTenant"

标签更新失败,因为文档与用户不属于同一租户。

documentReadOnly = "DocumentReadOnly"

文档为只读文件,无法修改。

insufficientPermission = "InsufficientPermission"

用户没有足够的权限来更新标签。

labelDisabled = "LabelDisabled"

标签更新失败,因为指定的标签已禁用或不适用于用户。

labelingDisabled = "LabelingDisabled"

标签更新失败,因为未为用户或已安装的 SKU 启用本机标签。

labelNotFound = "LabelNotFound"

找不到指定的敏感度标签。

parentLabelNotSupported = "ParentLabelNotSupported"

标签更新失败,因为指定的标签是父标签,无法应用。

removingLabelNotSupported = "RemovingLabelNotSupported"

标签更新失败,因为不支持删除敏感度标签。

success = "Success"

已成功更新敏感度标签。

unspecifiedFailure = "UnspecifiedFailure"

由于未指定的错误,更新失败。

unsupportedAbac = "UnsupportedAbac"

由于 ABAC) 属性值 (不支持基于属性的访问控制,标签更新失败。

unsupportedDoubleKeyEncryption = "UnsupportedDoubleKeyEncryption"

由于双密钥加密 (DKE) 不受支持,标签更新失败。

unsupportedUdp = "UnsupportedUdp"

由于不受支持的用户定义权限 (UDP) ,标签更新失败。

userNotFound = "UserNotFound"

标签更新失败,因为在标签应用过程中找不到用户的身份。