Word.SensitivityLabelAbacAttribute interface
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Represents an attribute-based access control (ABAC) attribute for sensitivity labels.
Remarks
API set: WordApi BETA (PREVIEW ONLY)
Used by
Examples
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/word/99-preview-apis/manage-sensitivity-labels.yaml
// Get available ABAC attributes and describe the kind of value each attribute accepts.
const container = document.getElementById("abac-attributes");
while (container.firstChild) {
container.removeChild(container.firstChild);
}
await Word.run(async (context) => {
const labelCatalog: Word.SensitivityLabelsCatalog = context.sensitivityLabelsCatalog;
if (!labelCatalog) {
console.warn("The sensitivity label catalog isn't available.");
return;
}
labelCatalog.load("getLabelingCapabilities");
await context.sync();
const capabilities: Word.LabelingCapability[] = labelCatalog.getLabelingCapabilities;
if (capabilities.indexOf(Word.LabelingCapability.attributeBasedAccessControlEnabled) === -1) {
console.warn("ABAC attributes aren't enabled or available for the current user.");
return;
}
const catalogAttributes: OfficeExtension.ClientResult<Word.SensitivityLabelAbacAttribute[]> =
labelCatalog.getAttributes();
await context.sync();
if (catalogAttributes.value.length === 0) {
console.log("No ABAC attributes are available in the sensitivity label catalog.");
return;
}
console.log("Available ABAC attributes:");
catalogAttributes.value.forEach((attribute: Word.SensitivityLabelAbacAttribute) => {
let dataTypeDescription: string;
switch (attribute.dataType) {
case Word.SensitivityLabelAbacAttributeDataType.booleanValue:
dataTypeDescription = "Boolean";
break;
case Word.SensitivityLabelAbacAttributeDataType.dateValue:
dataTypeDescription = "Date";
break;
case Word.SensitivityLabelAbacAttributeDataType.numberValue:
dataTypeDescription = "Number";
break;
case Word.SensitivityLabelAbacAttributeDataType.stringValue:
dataTypeDescription = "String";
break;
case Word.SensitivityLabelAbacAttributeDataType.unknown:
dataTypeDescription = "Unknown";
break;
default:
dataTypeDescription = `Unrecognized (${attribute.dataType})`;
break;
}
console.log(`ABAC attribute: ${attribute.displayName}`, {
dataType: attribute.dataType,
dataTypeDescription,
displayOrder: attribute.displayOrder,
isActive: attribute.isActive,
isMultiValued: attribute.isMultiValued,
values: attribute.values.map((attributeValue: Word.SensitivityLabelAbacAttributeValue) => ({
displayName: attributeValue.displayName,
displayOrder: attributeValue.displayOrder,
id: attributeValue.id,
isActive: attributeValue.isActive
}))
});
});
addAttributeOptions(catalogAttributes.value);
});
Properties
| data |
The data type of values for this ABAC attribute. |
| display |
The display name of the ABAC attribute. |
| display |
The display order of the ABAC attribute. |
| is |
Indicates whether the ABAC attribute is active. |
| is |
Indicates whether the ABAC attribute can have multiple values. |
| values | The values available for the ABAC attribute. |
Property Details
dataType
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
The data type of values for this ABAC attribute.
dataType: Word.SensitivityLabelAbacAttributeDataType | "Unknown" | "StringValue" | "BooleanValue" | "NumberValue" | "DateValue";
Property Value
Word.SensitivityLabelAbacAttributeDataType | "Unknown" | "StringValue" | "BooleanValue" | "NumberValue" | "DateValue"
Remarks
displayName
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
The display name of the ABAC attribute.
displayName: string;
Property Value
string
Remarks
displayOrder
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
The display order of the ABAC attribute.
displayOrder: number;
Property Value
number
Remarks
isActive
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Indicates whether the ABAC attribute is active.
isActive: boolean;
Property Value
boolean
Remarks
isMultiValued
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Indicates whether the ABAC attribute can have multiple values.
isMultiValued: boolean;
Property Value
boolean
Remarks
values
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
The values available for the ABAC attribute.
values: Word.SensitivityLabelAbacAttributeValue[];