Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Namespace: microsoft.graph
Important
APIs under the /beta version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported. To determine whether an API is available in v1.0, use the Version selector.
Remove the retention label from a driveItem. This operation clears the retention label and all associated retention settings enforced on the item.
For information about retention labels from an administrator's perspective, see Use retention labels to manage the lifecycle of documents stored in SharePoint.
This API is available in the following national cloud deployments.
| Global service | US Government L4 | US Government L5 (DOD) | China operated by 21Vianet |
|---|---|---|---|
| ✅ | ✅ | ✅ | ✅ |
Permissions
Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.
| Permission type | Least privileged permissions | Higher privileged permissions |
|---|---|---|
| Delegated (work or school account) | Files.Read.All | Files.ReadWrite.All, Sites.ReadWrite.All, Sites.FullControl.All |
| Delegated (personal Microsoft account) | Not supported. | Not supported. |
| Application | Files.Read.All | Files.ReadWrite.All, Sites.ReadWrite.All |
Note
Sites.FullControl.Allis the least privileged permission required to remove retention labels that classify the content as records.- The removal of a Record retention label isn't supported when using app-only authentication. This operation requires a delegated user context.
Note
SharePoint Embedded requires the FileStorageContainer.Selected permission to access the content of the container. This permission is different from the ones mentioned previously. In addition to Microsoft Graph permissions, your app must have the necessary container type permissions to call this API. For more information, see SharePoint Embedded authentication and authorization.
HTTP request
DELETE /drives/{drive-id}/items/{item-id}/retentionLabel
DELETE /groups/{group-id}/drive/items/{item-id}/retentionLabel
DELETE /me/drive/items/{item-id}/retentionLabel
DELETE /users/{user-id}/drive/items/{item-id}/retentionLabel
Request headers
| Name | Description |
|---|---|
| Authorization | Bearer {token}. Required. Learn more about authentication and authorization. |
Request body
Don't supply a request body for this method.
Response
If successful, this method returns a 204 No Content response code. It doesn't return anything in the response body.
Error responses
| Error code | HTTP status | Description |
|---|---|---|
| notSupported | 400 | App-only callers aren't supported for SharePoint Embedded containers. |
| accessDenied | 403 | The caller doesn't have permission to remove the retention label. |
| itemNotFound | 404 | The item can't be found or is no longer accessible. |
Examples
Example 1: Remove the retention label from a driveItem
The following example shows how to remove the retential label from a driveItem object.
Request
The following example shows a request.
DELETE https://graph.microsoft.com/beta/drives/b!t18F8ybsHUq1z3LTz8xvZqP8zaSWjkFNhsME-Fepo75dTf9vQKfeRblBZjoSQrd7/items/01NKDM7HMOJTVYMDOSXFDK2QJDXCDI3WUK/retentionLabel
Response
The following example shows the response.
HTTP/1.1 204 No Content
Example 2: Remove the retention label from a driveItem that fails due to insufficient permissions
The following example shows how to remove the retention label from a driveItem object that fails due to insufficient permissions.
Request
The following example shows a request.
DELETE https://graph.microsoft.com/beta/drives/b!t18F8ybsHUq1z3LTz8xvZqP8zaSWjkFNhsME-Fepo75dTf9vQKfeRblBZjoSQrd7/items/01NKDM7HMOJTVYMDOSXFDK2QJDXCDI3WUK/retentionLabel
Response
The following example shows the response.
HTTP/1.1 403 Forbidden
Content-Type: application/json
{
"error": {
"code": "accessDenied",
"message": "Access Denied: Do not have enough permission.",
"innerError": {
"request-id": "12345678-1234-1234-1234-123456789012",
"date": "2025-02-03T10:30:00"
}
}
}