You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/apis/csom-methods-for-applying-retention-labels.md
+38-1Lines changed: 38 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@ Retention labels let you apply retention settings for governance control at the
12
12
13
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
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.
15
+
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.
16
16
17
17
## SetComplianceTagOnBulkItems
18
18
@@ -34,6 +34,43 @@ public List<int> SetComplianceTagOnBulkItems(
Setting up Retention Labels settings for Microsoft Purview Records Management in Microsoft 365 is essential to properly monitor and enforce your organization's compliance policies. These APIs correspond to the settings under **[Microsoft Purview portal](https://purview.microsoft.com/)** or the **[Microsoft Purview compliance portal](/purview/purview-compliance-portal)** > **Records Management settings** > **Retention Labels**.
40
+
41
+
### Authentication and Permissions
42
+
43
+
__Permissions:__ Need to use account credentials of user who has __Tenant Admin__ role.
44
+
45
+
__Required scopes:__ Sites.FullControl.All
46
+
47
+
__Authentication:__ Generate user token using [https://login.microsoftonline.com/common/oauth2/token](https://login.microsoftonline.com/common/oauth2/token) and using the user credentials to generate a bearer token to be used for authentication to the API.
The common namespace is `SP.CompliancePolicy.SPPolicyStoreProxy`, and the prefix to use before each endpoint is `https://<tenant-name>.sharepoint.com/_api/SP.CompliancePolicy.SPPolicyStoreProxy`.
|Deleting content labeled for retention in OneDrive for Business|GET|`GetAllowFilesWithKeepLabelToBeDeletedODB`|N/A|`{"odata.metadata": https://<tenant-name>.sharepoint.com/_api/$metadata#Edm.Boolean","value": <Boolean>}`|
|Deleting content labeled for retention in SharePoint Online|GET|`GetAllowFilesWithKeepLabelToBeDeletedSPO`|N/A|`{"odata.metadata": https://<tenant-name>.sharepoint.com/_api/$metadata#Edm.Boolean","value": <Boolean>}`|
|Enable record versioning|GET|`GetAdvancedRecordVersioningDisabled`|N/A|`{"odata.metadata": https://<tenant-name>.sharepoint.com/_api/$metadata#Edm.Boolean","value": <Boolean>}`|
|Allow users to edit record properties|GET|`GetMetadataEditBlockingEnabled`|N/A|`{"odata.metadata": https://<tenant-name>.sharepoint.com/_api/$metadata#Edm.Boolean","value": <Boolean>}`|
Example: To get the value of *Deleting content labeled for retention in OneDrive for Business,* do the following:
67
+
68
+
1. Get the tenant name. In this case, assume it's contoso.
69
+
70
+
1. Make a GET API call to `https://contoso.sharepoint.com/_api/SP.CompliancePolicy.SPPolicyStoreProxy.GetAllowFilesWithKeepLabelToBeDeletedODB`.
71
+
72
+
1. You get a response as `{"odata.metadata": https://contoso.sharepoint.com/_api/$metadata#Edm.Boolean","value": true}` if it's enabled, or as `{"odata.metadata": https://contoso.sharepoint.com/_api/$metadata#Edm.Boolean","value": false}` if it's disabled.
0 commit comments