Edit

PowerPoint.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 available for selection on an ABAC-enabled sensitivity label.

Remarks

API set: PowerPointApi BETA (PREVIEW ONLY)

Used by

Examples

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/powerpoint/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 PowerPoint.run(async (context) => {
  const labelCatalog: PowerPoint.SensitivityLabelsCatalog = context.sensitivityLabelsCatalog;
  if (!labelCatalog) {
    console.warn("The sensitivity label catalog isn't available.");
    return;
  }

  labelCatalog.load("getLabelingCapabilities");
  await context.sync();

  const capabilities: PowerPoint.LabelingCapability[] = labelCatalog.getLabelingCapabilities;
  if (capabilities.indexOf(PowerPoint.LabelingCapability.attributeBasedAccessControlEnabled) === -1) {
    console.warn("ABAC attributes aren't enabled or available for the current user.");
    return;
  }

  const catalogAttributes: OfficeExtension.ClientResult<PowerPoint.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: PowerPoint.SensitivityLabelAbacAttribute) => {
    let dataTypeDescription: string;
    switch (attribute.dataType) {
      case PowerPoint.SensitivityLabelAbacAttributeDataType.booleanValue:
        dataTypeDescription = "Boolean";
        break;
      case PowerPoint.SensitivityLabelAbacAttributeDataType.dateValue:
        dataTypeDescription = "Date";
        break;
      case PowerPoint.SensitivityLabelAbacAttributeDataType.numberValue:
        dataTypeDescription = "Number";
        break;
      case PowerPoint.SensitivityLabelAbacAttributeDataType.stringValue:
        dataTypeDescription = "String";
        break;
      case PowerPoint.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: PowerPoint.SensitivityLabelAbacAttributeValue) => ({
        displayName: attributeValue.displayName,
        displayOrder: attributeValue.displayOrder,
        id: attributeValue.id,
        isActive: attributeValue.isActive
      }))
    });
  });

  addAttributeOptions(catalogAttributes.value);
});

Properties

dataType

Gets the data type of the ABAC attribute.

displayName

Gets the display name of the ABAC attribute. Add-ins are responsible for presenting localized user-facing UI.

displayOrder

Gets the recommended ordering of this ABAC attribute when displayed to a user.

isActive

Gets whether this ABAC attribute is active. true if the attribute is active; otherwise, false.

isMultiValued

Gets whether more than one value can be selected for this ABAC attribute. true if multi-select; otherwise, false.

values

Gets the values that are selectable for this 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.

Gets the data type of the ABAC attribute.

dataType: PowerPoint.SensitivityLabelAbacAttributeDataType | "Unknown" | "StringValue" | "BooleanValue" | "NumberValue" | "DateValue";

Property Value

PowerPoint.SensitivityLabelAbacAttributeDataType | "Unknown" | "StringValue" | "BooleanValue" | "NumberValue" | "DateValue"

Remarks

API set: PowerPointApi BETA (PREVIEW ONLY)

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.

Gets the display name of the ABAC attribute. Add-ins are responsible for presenting localized user-facing UI.

displayName: string;

Property Value

string

Remarks

API set: PowerPointApi BETA (PREVIEW ONLY)

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.

Gets the recommended ordering of this ABAC attribute when displayed to a user.

displayOrder: number;

Property Value

number

Remarks

API set: PowerPointApi BETA (PREVIEW ONLY)

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.

Gets whether this ABAC attribute is active. true if the attribute is active; otherwise, false.

isActive: boolean;

Property Value

boolean

Remarks

API set: PowerPointApi BETA (PREVIEW ONLY)

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.

Gets whether more than one value can be selected for this ABAC attribute. true if multi-select; otherwise, false.

isMultiValued: boolean;

Property Value

boolean

Remarks

API set: PowerPointApi BETA (PREVIEW ONLY)

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.

Gets the values that are selectable for this ABAC attribute.

values: PowerPoint.SensitivityLabelAbacAttributeValue[];

Property Value

Remarks

API set: PowerPointApi BETA (PREVIEW ONLY)