Shafkhan
Shafkhan

Reputation: 524

Upload files to One Drive using Graph API

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?

Upvotes: 4

Views: 1094

Answers (1)

Chauncy Zhou
Chauncy Zhou

Reputation: 1065

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

POST /users/{userId}/drive/items/{folderId}:/{fileNameUploadFile}:/createUploadSession

Upvotes: 1

Related Questions