I am copying a file from one drive to another. As part of the body request, I am also providing conflictBehavior as rename (tried with replace as well) but the copy is failing.
POST: https://graph.microsoft.com/beta/users/{user-id}/drive/items/{item-id}/copy
Body:
{
"parentReference": {"id": {folder-id-to-copy}, "driveId": {drive-id},
"@microsoft.graph.conflictBehavior": "rename"
}
After executing above command, as expected I get a 202 and in the header I look at Location. When querying the monitor URL, I see the below error:
{
"@odata.context": "https://{host-name}/_api/v2.1/$metadata#drives('default')/operations/$entity",
"id": "7a0decd4-df2f-4717-8eee-b7c2cd131009",
"createdDateTime": "0001-01-01T00:00:00Z",
"lastActionDateTime": "0001-01-01T00:00:00Z",
"status": "failed",
"error": {
"code": "nameAlreadyExists",
"message": "Name already exists"
}
}
What to pass in order to rename/replace existing file while copying