Agat
Agat

Reputation: 4779

Uploading a large file to OneDrive shared folder issue (createUploadSession error)

Although Microsoft official documentation quite rich, I can't find any details of how exactly I should upload the large file to a shared folder (not to my drive).

I've followed the docs:

POST /drives/{driveId}/items/{itemId}/createUploadSession

{"Item":{"@microsoft.graph.conflictBehavior":"replace","name":"20200310-155252-700.jpg"}}

Where the itemId is the folder id I am trying to upload that file to.

However, it returns 400 Bad Request error Name from path does not match name from body message.

But the request path provided in docs doesn't expect passing the file name at all!

I kind of suspecting that the itemId should be an existing item on the drive (not even inside the folder), rather than a folder id to create that file in, but a) I am not sure about that and b) how is it possible to have an empty file without any content before having that upload complete (again, if I am right about b)).

Am I at least following a right direction? Thanks!

Upvotes: 3

Views: 735

Answers (1)

Agat
Agat

Reputation: 4779

This is because poorly updated OneDrive Api official documentation Microsoft has.

A correct url must be as follows:

$"{baseUrl}/drives/{drive}/items/{itemId}:/{fileName}:/createUploadSession"

Upvotes: 6

Related Questions