Search code examples
apisharepointgraph

How to find a parent-id of a sharepoint folder?


I want to upload files to a certain existing folder inside a Sharepoint.

PUT /sites/{site-id}/drive/items/{parent-id}:/{filename}:/content

where to find the {parent-id}? I can not seem to find it, how to do this? i have a folder inside this Site, i want to know the Parent-ID of this folder.


Solution

  • If you donot know the folder id, you can also use the folder name instead of the folder id to upload files:

    PUT /sites/{site-id}/drive/root:/{folderName}/{filename}:/content
    

    To get the folder id:

    GET /sites/{site-id}/drive/root:/{folderName}
    

    enter image description here