2

According to the docs https://learn.microsoft.com/en-us/graph/api/driveitem-createuploadsession?view=graph-rest-1.0#create-an-upload-session, the acceptable routes are

POST /drives/{driveId}/items/{itemId}/createUploadSession
POST /groups/{groupId}/drive/items/{itemId}/createUploadSession
POST /me/drive/items/{itemId}/createUploadSession
POST /sites/{siteId}/drive/items/{itemId}/createUploadSession
POST /users/{userId}/drive/items/{itemId}/createUploadSession

I'm a bit confused as to what the itemId is supposed to be. I'm uploading a brand new file, it's not going to have an ID yet?

I tried

https://graph.microsoft.com/v1.0/drives/{driveId}/:root/foo.pdf:/createUploadSession and https://graph.microsoft.com/v1.0/me/drive/:root/foo.pdf:/createUploadSession based on this answer,but both resulted in

    {
      ...
        "code": "BadRequest",
        "message": "Resource not found for the segment 'foo.pdf'.",
      ...
     }
Chris A
  • 863
  • 1
  • 10
  • 31
  • 1
    Try `https://graph.microsoft.com/v1.0/me/drive/root:/ ... ` ie, 'root:' not ':root' – Hong Ooi Mar 17 '21 at 17:29
  • Does this answer your question? [How to perform a resumable Upload to a SharePoint Site (Not Root) Subfolder using MS Graph API](https://stackoverflow.com/questions/60402838/how-to-perform-a-resumable-upload-to-a-sharepoint-site-not-root-subfolder-usin) – Hong Ooi Mar 17 '21 at 17:39
  • @HongOoi that link is the same answer I posted, but yes, good spot on the `root:` typo, I'm still getting an error but it's a different one so I think that's the right path now. Thanks – Chris A Mar 17 '21 at 17:41
  • Good one @HongOoi and thanks Chris for confirming. Update the above as answer, so it can be useful to others in the community as well. – Dev Mar 18 '21 at 19:22
  • @ChrisA yes, I copied and pasted it from your link. The comment shows when you mark a question as a duplicate. – Hong Ooi Mar 19 '21 at 00:05

0 Answers0