Edit

Excel.SensitivityLabelUpdateResult 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 the result of an attempt to update the sensitivity label on the workbook. Carries the outcome status plus diagnostic information about why the update succeeded or failed.

Remarks

API set: ExcelApi BETA (PREVIEW ONLY)

Used by

Examples

// 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}`);
    }
});

Properties

status

Gets the outcome status of the update attempt.

Property Details

status

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 outcome status of the update attempt.

status: Excel.SensitivityLabelUpdateStatus | "Success" | "UnspecifiedFailure" | "LabelNotFound" | "DocumentReadOnly" | "InsufficientPermission" | "UnsupportedDoubleKeyEncryption" | "LabelingDisabled" | "UserNotFound" | "UnsupportedUdp" | "ParentLabelNotSupported" | "CrossTenant" | "AbacAttributesNotAllowed" | "AbacAttributesRequired" | "UnsupportedAbac" | "LabelDisabled" | "RemovingLabelNotSupported";

Property Value

Excel.SensitivityLabelUpdateStatus | "Success" | "UnspecifiedFailure" | "LabelNotFound" | "DocumentReadOnly" | "InsufficientPermission" | "UnsupportedDoubleKeyEncryption" | "LabelingDisabled" | "UserNotFound" | "UnsupportedUdp" | "ParentLabelNotSupported" | "CrossTenant" | "AbacAttributesNotAllowed" | "AbacAttributesRequired" | "UnsupportedAbac" | "LabelDisabled" | "RemovingLabelNotSupported"

Remarks

API set: ExcelApi BETA (PREVIEW ONLY)