How to perform a resumable Upload to a SharePoint Site (Not Root) Subfolder using MS Graph API

前端 未结 1 1275
我在风中等你
我在风中等你 2021-01-28 20:03

Documentation:

https://docs.microsoft.com/en-us/graph/api/driveitem-createuploadsession?view=graph-rest-1.0

I am able to get the Drive ID of the sub site using t

1条回答
  •  囚心锁ツ
    2021-01-28 20:23

    The request options in your question can only be used to upload a new version of an already existing document by using the id of the document. A folder does not have a document, that can be replace with a newer version. Therefore, it is not possible to create an upload session for a folder. You need to specify the name of the file as a relative path after the folder id in order to create an upload session for a new file in the folder:

    https://graph.microsoft.com/v1.0/sites/{siteId}/drives/{driveId}/items/{folderId}:/{fileNameUploadFile}:/createUploadSession
    

    You can also use the folder name instead of the folder id:

    https://graph.microsoft.com/v1.0/sites/{siteId}/drives/{driveId}/root:/{folderName}/{fileNameUploadFile}:/createUploadSession
    

    0 讨论(0)
提交回复
热议问题