onedrive-api-docs: How to setup createUploadSession when sending a (new) file to a shared folder (400 Bad Request error)
Although 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)).
Thanks!
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 16 (1 by maintainers)
Commits related to this issue
- Added missing POST request to upload a new file Responding to https://github.com/OneDrive/onedrive-api-docs/issues/1236#issuecomment-603213503 — committed to ioamnesia/onedrive-api-docs by ioamnesia 3 years ago
- Added missing POST request to upload a new file (#1439) * Added missing POST request to upload a new file Responding to https://github.com/OneDrive/onedrive-api-docs/issues/1236#issuecomment-60321... — committed to OneDrive/onedrive-api-docs by ioamnesia 3 years ago
@alextricity25, Hallelujah, I’ve finally found the solution myself! This is just an issue with their documentation. It seem has such low quality unlike of many other products! So, the correct request url must be as follows (instead of what’s said in the docs):
$"{baseUrl}/drives/{drive}/items/{itemId}:/{fileName}:/createUploadSession"It worked for me well.
After two weeks and “rapid” help from Microsoft, I’ve found the solution myself. Thanks [not] guys for helping on a primitive question! Well done!
I’m seeing the same thing when trying to create an upload session on a shared folder.
The request is quite simple and straight forward:
Response: