ADO.NET Provider for Microsoft SharePoint

Build 26.0.9655

GetFileSensitivityLabel

Retrieves the sensitivity label applied to a file in SharePoint, including both the label name and label ID. Useful for compliance auditing and data classification verification.

Stored Procedure-Specific Information

Note: Either UniqueId or RelativePath is required. You must specify one of these parameters to identify the file.

Note: This stored procedure applies only to files in document libraries. Item attachments do not support sensitivity labels.

To get the sensitivity label for a file using its UniqueId:

EXEC GetFileSensitivityLabel
  UniqueId = 'A3B5CD22-911E-419A-B00C-79C38017D1EC';

To get the sensitivity label for a file using its RelativePath:

EXEC GetFileSensitivityLabel
  RelativePath = '/sites/MySite/Shared Documents/MyFolder/SensitiveFile.docx';

Input

Name Type Required Description
UniqueId String False The unique identifier (GUID) of the file in SharePoint.
RelativePath String False The server-relative path of the file. For example: '/sites/MySite/Shared Documents/My Folder/My Document.txt'. Required if Id is not provided.

Result Set Columns

Name Type Description
Success Boolean Indicates whether the sensitivity label retrieval was successful. Returns 'true' for success and 'false' for failure.
LabelId String The unique identifier (GUID) of the sensitivity label applied to the file. Returns null if no label is applied.
LabelName String The display name of the sensitivity label applied to the file. Returns null if no label is applied.
ErrorCode Integer The error code returned if the operation fails. Returns null on success.
ErrorMessage String Details of any error encountered during the operation. Returns null on success.

Copyright (c) 2026 CData Software, Inc. - All rights reserved.
Build 26.0.9655