|
| 1 | +--- |
| 2 | +title: CSOM methods for applying retention labels |
| 3 | +description: CSOM methods are available to apply (set) a retention label (ComplianceTag) on one or many items (ListItems) in SharePoint. |
| 4 | +author: kyracatwork |
| 5 | +ms.author: kyrachurney |
| 6 | +ms.date: 4/18/2023 |
| 7 | +--- |
| 8 | + |
| 9 | +# CSOM methods for applying retention labels (setting ComplianceTags) |
| 10 | + |
| 11 | +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.](/microsoft-365/compliance/retention#retention-labels) |
| 12 | + |
| 13 | +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](/microsoft-365/compliance/declare-records) |
| 14 | + |
| 15 | +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. |
| 16 | + |
| 17 | +> [!IMPORTANT] |
| 18 | +> Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here. |
| 19 | +
|
| 20 | +## SetComplianceTagOnBulkItems |
| 21 | + |
| 22 | +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. |
| 23 | + |
| 24 | +```c# |
| 25 | +public List<int> SetComplianceTagOnBulkItems( |
| 26 | + List<int> itemIds, |
| 27 | + string listUrl, |
| 28 | + string complianceTagValue) |
| 29 | +``` |
| 30 | + |
| 31 | +### Parameters |
| 32 | + |
| 33 | +- 'List' [Int](/en-us/dotnet/api/system.int32) |
| 34 | +- 'ItemsIds' [String](/dotnet/api/system.string) |
| 35 | +- 'ListURL' [String](/dotnet/api/system.string) |
| 36 | +- 'ComplianceTagValue' [String](/dotnet/api/system.string) |
| 37 | + |
| 38 | +Attribute [RemoteAttribute](/dotnet/api/microsoft.sharepoint.client.remoteattribute) |
| 39 | + |
| 40 | +### Applies to |
| 41 | + |
| 42 | +|Product|Versions| |
| 43 | +|:---|:---| |
| 44 | +|SharePoint CSOM|latest| |
| 45 | + |
| 46 | +## Other |
| 47 | + |
| 48 | +> [!NOTE] |
| 49 | +> It is strongly recommended to use SetComplianceTagOnBulkItems instead of these methods. |
| 50 | +
|
| 51 | +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. |
| 52 | + |
| 53 | +* [SetComplianceTag](/dotnet/api/microsoft.sharepoint.client.listitem.setcompliancetag) |
| 54 | +* [SetComplianceTagWithExplicitMetaInfo](/dotnet/api/microsoft.sharepoint.client.listitem.setcompliancetagwithexplicitmetasupdate) |
| 55 | +* [SetComplianceTagWithExplicitMetasUpdate](/dotnet/api/microsoft.sharepoint.client.listitem.setcompliancetagwithexplicitmetasupdate) |
| 56 | +* [SetComplianceTagWithHold](/dotnet/api/microsoft.sharepoint.client.listitem.setcompliancetagwithhold) |
| 57 | +* [SetComplianceTagWithMetaInfo](/dotnet/api/microsoft.sharepoint.client.listitem.setcompliancetagwithmetainfo) |
| 58 | +* [SetComplianceTagWithNoHold](/dotnet/api/microsoft.sharepoint.client.listitem.setcompliancetagwithnohold) |
| 59 | +* [SetComplianceTagWithRecord](/dotnet/api/microsoft.sharepoint.client.listitem.setcompliancetagwithrecord) |
0 commit comments