CSOM methods for applying retention labels (setting ComplianceTags)

Retention labels let you apply retention settings for governance control at the item level, and are part of the Microsoft Purview compliance solutions. Learn more about retention labels.

Retention labels may classify contents as records, which place restrictions on what actions are allowed or blocked. Learn more about declaring records by using retention labels

CSOM methods are available to apply (set) a retention label (ComplianceTag) on one or many items (ListItems) in SharePoint. Retention labels can be applied using this method without being published to the location by an existing label policy.

SetComplianceTagOnBulkItems

This method can be used to set a ComplianceTag on one or many ListItems. It is strongly recommended to use this method for this purpose.

public List<int> SetComplianceTagOnBulkItems( 
             List<int> itemIds, 
             string listUrl, 
             string complianceTagValue)

Parameters

Attribute RemoteAttribute

Applies to

Product Versions
SharePoint CSOM latest

Other

Note

It is strongly recommended to use SetComplianceTagOnBulkItems instead of these methods.

The following methods are also available, but are no longer updated and may be subject to deprecation in the future. If you are using these methods, we strongly recommend use of the SetComplianceTagOnBulkItems method instead.