Word.SensitivityLabelAbacAttributeValue interface

注意

この API は開発者向けにプレビューとして提供されており、寄せられたフィードバックにもとづいて変更される場合があります。 この API は運用環境で使用しないでください。

秘密度ラベルの単一の属性ベースのアクセス制御 (ABAC) 属性値を表します。

注釈

API セット: WordApi ベータ版 (プレビューのみ)

使用元

例

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/word/99-preview-apis/manage-sensitivity-labels.yaml

await Word.run(async (context) => {
  // Get the sensitivity label currently applied to the document.
  const wordDocument: Word.Document = context.document;
  const documentLabel: Word.SensitivityLabel = wordDocument.sensitivityLabel;

  const currentLabel: Word.SensitivityLabelDetails = documentLabel.getCurrentOrNullObject();
  // Load the properties of the label currently applied to the document.
  currentLabel.load(
    "color,id,isAbacAttributesRequired,isAbacEnabled,isEnabled,name,order,protectionType,siteId,tooltip"
  );

  await context.sync();
  if (currentLabel.isNullObject) {
    console.log("The document doesn't have a sensitivity label.");
    return;
  }

  // Load ABAC values when supported.
  let abacAttributeValues: Word.SensitivityLabelAbacAttributeValue[] = [];
  const isAbacEnabled = currentLabel.isAbacEnabled;
  if (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: Word.SensitivityLabelAbacAttributeValue) =>
            `${attributeValue.displayName} (ID: ${attributeValue.id}, order: ${attributeValue.displayOrder}, active: ${attributeValue.isActive ? "Yes" : "No"})`
        )
        .join(", ")
    : "None";
  let protectionDescription: string;
  switch (currentLabel.protectionType) {
    case Word.SensitivityLabelProtectionType.adminDefined:
      protectionDescription = "Defined by an administrator";
      break;
    case Word.SensitivityLabelProtectionType.userDefined:
      protectionDescription = "Defined by the user";
      break;
    case Word.SensitivityLabelProtectionType.noProtection:
      protectionDescription = "No protection";
      break;
    default:
      protectionDescription = `Unknown (${currentLabel.protectionType})`;
      break;
  }

  console.log(
    `Current document 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}`
  );
});

プロパティ

displayName

ABAC 属性値の表示名。

displayOrder

ABAC 属性値の表示順序。

id

ABAC 属性値の一意識別子。

isActive

ABAC 属性値がアクティブかどうかを示します。

プロパティの詳細

displayName

注意

この API は開発者向けにプレビューとして提供されており、寄せられたフィードバックにもとづいて変更される場合があります。 この API は運用環境で使用しないでください。

ABAC 属性値の表示名。

displayName: string;

プロパティ値

string

注釈

API セット: WordApi ベータ版 (プレビューのみ)

displayOrder

注意

この API は開発者向けにプレビューとして提供されており、寄せられたフィードバックにもとづいて変更される場合があります。 この API は運用環境で使用しないでください。

ABAC 属性値の表示順序。

displayOrder: number;

プロパティ値

number

注釈

API セット: WordApi ベータ版 (プレビューのみ)

id

注意

この API は開発者向けにプレビューとして提供されており、寄せられたフィードバックにもとづいて変更される場合があります。 この API は運用環境で使用しないでください。

ABAC 属性値の一意識別子。

id: string;

プロパティ値

string

注釈

API セット: WordApi ベータ版 (プレビューのみ)

isActive

注意

この API は開発者向けにプレビューとして提供されており、寄せられたフィードバックにもとづいて変更される場合があります。 この API は運用環境で使用しないでください。

ABAC 属性値がアクティブかどうかを示します。

isActive: boolean;

プロパティ値

boolean

注釈

API セット: WordApi ベータ版 (プレビューのみ)