How to upload a file with no file id?

Viewed 348

According to the docs https://docs.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'.",
      ...
     }
0 Answers
Related