Using Microsoft Graph to filter on siteCollection property

Established Member

I want to get a list of all SharePoint sites on the tenant using Graph. But when I make a request, it brings everything including user OneDrives. From the data it seems that you can use siteCollection property to filter the data.

siteCollection : @{hostname=xxxxxxx-my.sharepoint.com} - OneDrive

siteCollection : @{hostname=xxxxxxx.sharepoint.com} - SharePoint Site

 

I am making requests via PowerShell. So far tried variations of these:

$v1/sites?`$select=webUrl,siteCollection&`$search=`"siteCollection:hostname=xxxxxxx.sharepoint.com`"
$v1/sites?`$select=webUrl,siteCollection&`$count=true&`$filter=startsWith(siteCollection,'hostname=xxxxxxx.sharepoint.com')
$v1/sites?`$select=webUrl,siteCollection&`$search=%22siteCollection:hostname=xxxxxx.sharepoint.com%22

But no luck. Just brings back empty value

@odata.context                                                                                                  value
--------------                                                                                                       -----
https://graph.microsoft.com/v1.0/$metadata#sites(webUrl,siteCollection)       {}

 

0 Replies