I am attempting to use Microsoft graph to copy sharepoint files from one folder to one of the subfolders. I followed the syntax that was documented on the Microsoft site. I received the error that the "item was not found" and the I also included the driveid and got the error "item already exists". I was following the instructions provided in https://developer.microsoft.com/en-us/microsoft-365/blogs/microsoft-graph-mailbag-copy-move-files-and-folders-in-sharepoint-online/.
item not found
POST /sites/{siteId}/drive/items/{itemId}/copy
REQUEST BODY
{
"parentReference": {
"driveId": "<driveID>",
"id": "<driveID>"
},
"name": "<filename>"
}
item already exists
POST /sites/{siteId}/drive/{driveid}/items/{itemId}/copy
REQUEST BODY
{
"parentReference": {
"driveId": "<driveID>",
"id": "<driveID>"
},
"name": "<filename>"
}
https://graph.microsoft.com/v1.0/sites/coxcomminc.sharepoint.com,c80fc32c-7057-4cc6-881f-3a1c9ae3c377,fbecb94e-b16f-4be1-ab7b-4e9be34df31f/drive/items/0175UB7YWSAPE26ILFCREL73RWHBRRT3TI/copy
{
"parentReference": {
"driveId": "b!LMMPyFdwxkyIHzocmuPDd0657PtvseFLq3tOm-NN8x_vtqchuBJ2Rr-ZJOA6WIQ8",
"id": "0175UB7YV6Y2GOVW7725BZO354PWSELRRZ"
},
"name": "test.doc"
}
{
"error": {
"code": "itemNotFound",
"message": "The resource could not be found.",
"innerError": {
"date": "2021-10-01T12:00:37",
"request-id": "c410b4f9-029e-48e0-bdc9-bf4de4a48973",
"client-request-id": "ad0191db-614c-e3e4-c6e1-fcfa5b7e78c5"
}
}
}
{
"error": {
"code": "nameAlreadyExists",
"message": "The specified item name already exists.",
"innerError": {
"date": "2021-09-30T16:37:18",
"request-id": "57a3dd90-2eaf-4e77-b0e6-50c3b4641584",
"client-request-id": "fc3e1a88-1bea-3820-5241-ed8a46de9ded"
}
}
}