Edit

Share via


CSOM methods for applying retention labels and managing settings of record labels

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, and change retention labels settings for deleting, versioning, and changing properties of records. 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

GetAllowFilesWithKeepLabelToBeDeletedODB

Get whether files with Keep Label can be deleted in ODB.


public static bool GetAllowFilesWithKeepLabelToBeDeletedODB()

SetAllowFilesWithKeepLabelToBeDeletedODB

Set whether files with Keep Label can be deleted in ODB

public static void SetAllowFilesWithKeepLabelToBeDeletedODB(bool allowDeletion)

Parameters

GetAllowFilesWithKeepLabelToBeDeletedSPO

Get whether files with Keep Label can be deleted in SPO.


public static bool GetAllowFilesWithKeepLabelToBeDeletedSPO()

SetAllowFilesWithKeepLabelToBeDeletedSPO

Set whether files with Keep Label can be deleted in SPO.

public static void SetAllowFilesWithKeepLabelToBeDeletedSPO(bool allowDeletion)

Parameters

GetAdvancedRecordVersioningDisabled

Get whether advanced record versioning is disabled.


public static bool GetAdvancedRecordVersioningDisabled()

SetAdvancedRecordVersioningDisabled

Set to enable or disable the advanced record versioning.

public static void SetAdvancedRecordVersioningDisabled(bool disabled)

Parameters

GetMetadataEditBlockingEnabled

Get whether metadata edit blocking is enabled.


public static bool GetMetadataEditBlockingEnabled()

SetMetadataEditBlockingEnabled

Set metadata edit blocking enabled setting.

public static void SetMetadataEditBlockingEnabled(bool enabled)

Parameters

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.