Reputation: 11
i am trying to upload file to a sharepoint subsite document library and struggling in getting the site id / drive id of subsite and document library.
I already follow this article(https://www.sharepointdiary.com/2018/04/sharepoint-online-powershell-to-get-site-collection-web-id.html#:~:text=Here%20is%20how%20to%20find,%3E%2F_api%2Fweb%2Fid) and it is giving me web id but when i am doing the Get call to (https://graph.microsoft.com/v1.0/sites/webid)it is giving below error
{ "error": { "code": "itemNotFound", "message": "Item not found", "innerError": { "date": "2024-05-22T13:43:03", "request-id": "1771c172-052d-4d54-9087-66c891ebb869", "client-request-id": "1771c172-052d-4d54-9087-66c891ebb869" } } }
Upvotes: 0
Views: 329
Reputation: 11
To get the subsite you have to first get the webid of subsite by following this url "https://.sharepoint.com//_api/web/id" and once you have that you can do a Get call to for subsite details
https://graph.microsoft.com/v1.0/sites/site-id,webid
To get the drives list under subsite follow https://graph.microsoft.com/v1.0/sites/site-id,webid/drives
Upvotes: 0
Reputation: 354
The webid in this case (https://graph.microsoft.com/v1.0/sites/webid) can only be the site collection id, please try this:
https://graph.microsoft.com/v1.0/sites/tenant.sharepoint.com:/sites/siteName/subSiteName/
Upvotes: 0