I'd like to perform some operations that are only available using the GRAPH Api (adding content from the content type hub for example).
But I'm in a context where I can only perform operations using the SharePoint authenticated context (Power Automate SharePoint connector if it matters). That's why I need to use the SharePoint REST V2 endpoint (/_api/v2.0
) and not the standard graph endpoint.
I'm struggling to get the current site ID (graph ID, not SharePoint ID).
How can I retrieve it ?
There are attributes on File object that provide DriveID (VroomDriveID), but I did not find similar attribute for site or web.
I tried:
- get
https://mytenant.sharepoint.com/sites/mysite/_api/v2.0/sites/mytenant.sharepoint.com:/sites/mysite
but it does not work - get the drive ID first, then trying to reach the drive:
https://mytenant.sharepoint.com/sites/mysite/_api/web/getlist('/sites/mysite/sitepages')/items?$expand=File&$filter=FSObjType eq 0&$top=1&$select=File/VroomItemID,File/VroomDriveID
(assuming there's at least one page in the site). This allow me to retrieve one DriveID- then
https://mytenant.sharepoint.com/sites/mysite/_api/2.0/drives/<<value of VroomDriveID>>
. It also fails
- search for the current site :
https://mytenant.sharepoint.com/sites/mysite/_api/v2.0/sites?search='/sites/mysite'
. The query does not fails, but return an empty array