# Update Doclib File Sensitivity Label

Updates the Microsoft Purview sensitivity label on all documents in a document library by processing rows from an Excel file.

Filename pattern: filename must contain UpdateDoclibFileSensitivityLabel (case-insensitive).
Example: 20240115 UpdateDoclibFileSensitivityLabel.xlsx

# Columns

Name Required Description
ClientCode No Client code used to identify the matter.
MatterCode Conditional Matter code used to resolve document libraries from the matter list. Required when Url is not provided.
Url Conditional Server-relative URL of the document library. Required when MatterCode is not provided.
SensitivityLabel No Name of the sensitivity label to apply. When omitted, removes the existing label.
SensitivityLabel_Overwrite No Boolean. When true, the label is applied even if the document already has a label. Default: false.

Either MatterCode or Url must be provided.

# Behavior

The handler resolves the target document library (from MatterCode or Url) and calls SPDocument.UpdateFileSensitivityLabel on each document. When SensitivityLabel_Overwrite is false, documents that already have a label are skipped.

Last Updated: 4/20/2026, 12:54:05 PM