4

I am trying to upload a small word document to a folder in my One Drive using Graph API. I am using this endpoint to create the upload session.

POST /users/{userId}/drive/items/{itemId}/createUploadSession

It is giving me the following error:

{
  "error": {
    "code": "nameAlreadyExists",
    "message": "Cannot create an upload session on a folder",
    "innerError": {
      "date": "2020-09-22T09:52:51",
      "request-id": "********",
      "client-request-id": "********"
    }
  }
}

what am I doing wrong?

Shafkhan
  • 456
  • 4
  • 19
  • 1
    Please check this [SO thread](https://stackoverflow.com/questions/60402838/how-to-perform-a-resumable-upload-to-a-sharepoint-site-not-root-subfolder-usin) and see if it can help. – Shiva Keshav Varma Sep 22 '20 at 14:27
  • Thank you, I understood the issue. I am trying to upload files to a folder. Am I using the correct endpoint to do this? – Shafkhan Sep 23 '20 at 05:49

1 Answers1

1

You cannot work on a folder, but on a file.

POST /users/{userId}/drive/items/{folderId}:/{fileNameUploadFile}:/createUploadSession
Chauncy Zhou
  • 1,010
  • 1
  • 5
  • 10