Closed raclettierer closed 1 month ago
Hey @raclettierer ,
In PnP Core SDK under the covers we use three different approaches to enumerate site collections depending on the permissions used when issuing the request. See https://github.com/pnp/pnpcore/blob/dev/src/sdk/PnP.Core.Admin/Model/SharePoint/Core/Internal/SiteCollectionEnumerator.cs#L18-L35. In PowerShell a specific CSOM method is used for this reason (https://github.com/pnp/powershell/blob/bdd6d09cd16c08915e92df5f8ab48acf0d2af9ff/src/Commands/Admin/GetTenantSite.cs#L74-L114).
Given our current implementation this is not something we can easily add right now. I would recommend the following strategies:
GetSiteCollectionPropertiesAsync
methodHi @raclettierer ,
I'll be closing this one as we do not want to pull in more CSOM that necessary, hope the provided strategies do help.
Category
Describe the feature
I like to query only a subset of all tenant sites. With PNP Powershell I can set a query based on url.
Describe the solution you'd like
I need to set a filter for the url in code ... await adminContext.GetSiteCollectionManager().GetSiteCollectionsAsync(filter: SiteCollectionFilter.ExcludePersonalSites)
Similar like
Get-PnPTenantSite -Filter "Url -like '/sites/myprefix_'" -Detailed
orGet-SPOSite -Filter { Url -like "contoso.sharepoint.com/sites/18" }
Additional context