Skip to content

Commit 153504f

Browse files
Merge pull request SharePoint#8905 from kyracatwork/patch-1
New CSOM doc for retention labels
2 parents 3382b00 + 05a007d commit 153504f

File tree

2 files changed

+61
-0
lines changed

2 files changed

+61
-0
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
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)

docs/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2083,6 +2083,8 @@
20832083
href: apis/sharepoint-rest-graph.md
20842084
- name: Application Lifecycle Management (ALM) APIs
20852085
href: apis/alm-api-for-spfx-add-ins.md
2086+
- name: CSOM methods for applying retention labels
2087+
href: apis/csom-methods-for-applying-retention-labels.md
20862088
- name: SharePoint Add-in Management APIs
20872089
href: apis/addin-management-apis.md
20882090
- name: Microsoft 365 Copy and Move API

0 commit comments

Comments
 (0)