Skip to content

Latest commit

 

History

History
202 lines (151 loc) · 8.06 KB

File metadata and controls

202 lines (151 loc) · 8.06 KB
title driveItem: removeRetentionLabel
description Remove the retention label from a driveItem.
author kyracatwork
ms.localizationpriority medium
ms.subservice onedrive
doc_type apiPageType
ms.date 02/03/2026

driveItem: removeRetentionLabel

Namespace: microsoft.graph

[!INCLUDE beta-disclaimer]

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.

[!INCLUDE national-cloud-support]

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.

[!INCLUDE permissions-table]

Note

  • Sites.FullControl.All is 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.

[!INCLUDE app-permissions]

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

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]


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

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]


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"
    }
  }
}