Excel.SensitivityLabelUpdateResult interface
注意
此 API 以预览状态提供给开发者,可能根据我们收到的反馈更改。 请勿在生产环境中使用此 API。
表示尝试更新工作簿上的敏感度标签的结果。 携带结果状态以及有关更新成功或失败原因的诊断信息。
注解
使用方
示例
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/98-preview-apis/manage-sensitivity-labels.yaml
// Apply the selected sensitivity label to the entire workbook.
await Excel.run(async (context) => {
const labelId = (document.getElementById("label-id") as HTMLSelectElement).value;
if (!labelId) {
console.warn("Get available labels and select a label first.");
return;
}
const workbook: Excel.Workbook = context.workbook;
const workbookLabel: Excel.SensitivityLabel = workbook.sensitivityLabel;
const updateResult: OfficeExtension.ClientResult<Excel.SensitivityLabelUpdateResult> =
workbookLabel.tryToUpdate(labelId);
await context.sync();
if (updateResult.value.status === Excel.SensitivityLabelUpdateStatus.success) {
console.log("Applied the sensitivity label to the workbook.");
} else {
console.error(`The sensitivity label wasn't applied. Status: ${updateResult.value.status}`);
}
});
属性
| status | 获取更新尝试的结果状态。 |
属性详细信息
status
注意
此 API 以预览状态提供给开发者,可能根据我们收到的反馈更改。 请勿在生产环境中使用此 API。
获取更新尝试的结果状态。
status: Excel.SensitivityLabelUpdateStatus | "Success" | "UnspecifiedFailure" | "LabelNotFound" | "DocumentReadOnly" | "InsufficientPermission" | "UnsupportedDoubleKeyEncryption" | "LabelingDisabled" | "UserNotFound" | "UnsupportedUdp" | "ParentLabelNotSupported" | "CrossTenant" | "AbacAttributesNotAllowed" | "AbacAttributesRequired" | "UnsupportedAbac" | "LabelDisabled" | "RemovingLabelNotSupported";
属性值
Excel.SensitivityLabelUpdateStatus | "Success" | "UnspecifiedFailure" | "LabelNotFound" | "DocumentReadOnly" | "InsufficientPermission" | "UnsupportedDoubleKeyEncryption" | "LabelingDisabled" | "UserNotFound" | "UnsupportedUdp" | "ParentLabelNotSupported" | "CrossTenant" | "AbacAttributesNotAllowed" | "AbacAttributesRequired" | "UnsupportedAbac" | "LabelDisabled" | "RemovingLabelNotSupported"