Forum Discussion
soniabouna
Feb 16, 2024Copper Contributor
Allow filtering on site properties
It would be great to be able to filter the list sites request on site properties like "isPersonalSite" or "deleted". Currently, one can only filter on "siteCollection".
MikeCrowley
Apr 19, 2024Iron Contributor
soniabouna You Can filter out personal sites with the ne clause. For example, in PowerShell:
$uri = @'
beta/sites/getAllSites?$filter=isPersonalSite ne true&top=999&$count=true
'@
$headers =@{
ConsistencyLevel = "eventual"
}
$Sites = Invoke-MgGraphRequest -Uri $uri -Headers $headers
$Sites.value