driveItem: restore

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.

Restore a driveItem that has been deleted and is currently in the recycle bin. NOTE: This functionality is currently only available for OneDrive Personal.

Permissions

One of the following permissions is required to call this API. To learn more, including how to choose permissions, see Permissions.

Permission type Permissions (from least to most privileged)
Delegated (work or school account) Not supported.
Delegated (personal Microsoft account) Files.ReadWrite.All
Application Files.ReadWrite.All

HTTP request

POST /me/drive/items/{item-id}/restore

Request headers

Name Description
Authorization Bearer {token}

Request body

In the request body, provide a JSON object with the following parameters.

Parameter Type Description
parentReference ItemReference Optional. Reference to the parent item the deleted item will be restored to.
name String Optional. The new name for the restored item. If this isn't provided, the same name will be used as the original.

Response

If successful, this method returns 200 OK response code and the restored driveItem object in the response body.

Examples

The following example shows how to call this API.

Request

The following is an example of the request.

POST https://graph.microsoft.com/beta/me/drive/items/{item-id}/restore
Content-type: application/json

{
  "parentReference": {
    "id": "String",
  },
  "name": "String"
}

Response

The following is an example of the response.

Note: The response object shown here might be shortened for readability. All the properties will be returned from an actual call.

HTTP/1.1 200 OK
Content-type: application/json

{
  "id": "1312abc!1231",
  "name": "new-restored-item-name.txt",
  "size": 19121,
  "lastModifiedDateTime": "2017-12-12T10:40:59Z"
}