Update the metadata for an item in OneDrive by ID or path. You can also use update to move an item to another parent by updating the item's parentReference facet.
To call this method to change an item's metadata, the user must have granted the application write access to the item.
PATCH /drive/items/{item-id}
PATCH /drive/root:/{item-path}
Name | Value | Description |
---|---|---|
if-match | etag | If this request header is included and the eTag (or cTag) provided does not match the current eTag on the folder, a 412 Precondition Failed response is returned. |
In the request body, supply the values for relevant fields that should be updated. Existing properties that are not included in the request body will maintain their previous values or be recalculated based on changes to other property values. For best performance you shouldn't include existing values that haven't changed.
This example renames and moves a folder to a new parent path.
PATCH /drive/items/{item-id}
Content-Type: application/json
{
"name": "NewFolderName",
"parentReference" : {"path": "/drive/root:/Documents"}
}
If successful, this method returns an Item resource in the response body.
HTTP/1.1 200 OK
Content-Type: application/json
{
"id": "0123456789abc",
"name": "BFolder",
"folder": { "childCount": 3 }
}
Note: The response object is truncated for clarity. All default properties will be returned from the actual call.
See Error Responses for details about how errors are returned.