PowerPoint.SensitivityLabelAbacAttributeValue interface
注意
此 API 以预览状态提供给开发者,可能根据我们收到的反馈更改。 请勿在生产环境中使用此 API。
表示可应用于敏感度标签的基于属性的访问控制 (ABAC) 属性的单个可选值。
注解
API 集:PowerPointApi BETA (仅预览版)
使用方
- PowerPoint.SensitivityLabelAbacAttribute: values
- PowerPoint.SensitivityLabelDetails: abacAttributeValues
示例
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/powerpoint/preview-apis/manage-sensitivity-labels.yaml
await PowerPoint.run(async (context) => {
// Get the sensitivity label currently applied to the presentation.
const presentation: PowerPoint.Presentation = context.presentation;
const presentationLabel: PowerPoint.SensitivityLabel = presentation.sensitivityLabel;
const currentLabel: PowerPoint.SensitivityLabelDetails = presentationLabel.getCurrentOrNullObject();
// Load the properties of the label currently applied to the presentation.
currentLabel.load(
"color,id,isAbacAttributesRequired,isAbacEnabled,isEnabled,name,order,protectionType,siteId,tooltip"
);
await context.sync();
if (currentLabel.isNullObject) {
console.log("The presentation doesn't have a sensitivity label.");
return;
}
// Get ABAC values when enabled for the label.
let abacAttributeValues: PowerPoint.SensitivityLabelAbacAttributeValue[] = [];
if (currentLabel.isAbacEnabled) {
currentLabel.load("abacAttributeValues");
await context.sync();
abacAttributeValues = currentLabel.abacAttributeValues;
}
// Display the loaded properties of the current label.
const attributeValues = abacAttributeValues.length
? abacAttributeValues
.map(
(attributeValue: PowerPoint.SensitivityLabelAbacAttributeValue) =>
`${attributeValue.displayName} (ID: ${attributeValue.id}, order: ${attributeValue.displayOrder}, active: ${attributeValue.isActive ? "Yes" : "No"})`
)
.join(", ")
: "None";
let protectionDescription: string;
switch (currentLabel.protectionType) {
case PowerPoint.SensitivityLabelProtectionType.adminDefined:
protectionDescription = "Defined by an administrator";
break;
case PowerPoint.SensitivityLabelProtectionType.userDefined:
protectionDescription = "Defined by the user";
break;
case PowerPoint.SensitivityLabelProtectionType.noProtection:
protectionDescription = "No protection";
break;
default:
protectionDescription = `Unknown (${currentLabel.protectionType})`;
break;
}
console.log(
`Current presentation sensitivity label:\n\n${currentLabel.name}\n` +
` ID: ${currentLabel.id}\n` +
` Site ID: ${currentLabel.siteId}\n` +
` Tooltip: ${currentLabel.tooltip}\n` +
` Color: ${currentLabel.color}\n` +
` Enabled: ${currentLabel.isEnabled ? "Yes" : "No"}\n` +
` Display order: ${currentLabel.order}\n` +
` ABAC enabled: ${currentLabel.isAbacEnabled ? "Yes" : "No"}\n` +
` ABAC attributes required: ${currentLabel.isAbacAttributesRequired ? "Yes" : "No"}\n` +
` ABAC attribute values: ${attributeValues}\n` +
` Protection type: ${protectionDescription}`
);
});
属性
| display |
获取 ABAC 属性值的显示名称。 加载项负责呈现面向用户的本地化 UI。 |
| display |
向用户显示时,获取此 ABAC 值在其属性内的建议顺序。 |
| id | 获取 ABAC 属性值的唯一标识符。 应用或更新标签的 ABAC 属性选择时使用此标识符。 |
| is |
获取此 ABAC 属性值是否处于活动状态。
|
属性详细信息
displayName
注意
此 API 以预览状态提供给开发者,可能根据我们收到的反馈更改。 请勿在生产环境中使用此 API。
获取 ABAC 属性值的显示名称。 加载项负责呈现面向用户的本地化 UI。
displayName: string;
属性值
string
注解
displayOrder
注意
此 API 以预览状态提供给开发者,可能根据我们收到的反馈更改。 请勿在生产环境中使用此 API。
向用户显示时,获取此 ABAC 值在其属性内的建议顺序。
displayOrder: number;
属性值
number
注解
id
注意
此 API 以预览状态提供给开发者,可能根据我们收到的反馈更改。 请勿在生产环境中使用此 API。
获取 ABAC 属性值的唯一标识符。 应用或更新标签的 ABAC 属性选择时使用此标识符。
id: string;
属性值
string
注解
isActive
注意
此 API 以预览状态提供给开发者,可能根据我们收到的反馈更改。 请勿在生产环境中使用此 API。
获取此 ABAC 属性值是否处于活动状态。
true 如果值处于活动状态;否则为 false.
isActive: boolean;
属性值
boolean