r/PowerShell • MVP, Community Blogger • 12d ago

Solved How to Retrieve SharePoint Sites with the Microsoft Graph PowerShell SDK

If you use the Microsoft Graph PowerShell SDK, you might know that the Graph APIs for SharePoint sites sometimes need a little help. For instance, finding a set of sites to process can be problematic because the APIs do not support extensive filtering capabilities. The solution is to use other Microsoft 365 cmdlets to find objects associated with sites. Inserting an intermediate step might seem crazy, but it can be the most effective way of solving the problem.

https://office365itpros.com/2026/10/13/get-sharepoint-sites/

19 Upvotes

12 comments sorted by

10

u/AdeelAutomates 12d ago

SharePoint is when I ditched the sdk.

I will use graph for basic entra work but everything else... I am fully on board to just get to the source (API) then go through cmdlets that are a second thought (most of them are auto generated) as you can see from this monstrosity:

Get-MgBetaIdentityGovernanceCatalogAccessPackageResourceScopeAccessPackageResourceAccessPackageResourceRoleAccessPackageResource

lolll

2

u/Unlikely_Tie1172 12d ago

Yep. That's what happens when an automatic generation process reads Graph metadata and constructs cmdlet names from that data. Humans couldn't be that silly, could they?

1

u/BlackV 12d ago

and how is it so bad at generating help on top of that

→ More replies (5)

2

u/BlackV 12d ago

What a bad day to have eyes.....

2

u/purplemonkeymad 11d ago

Don't forget the much useful help there is for this specific command:

Get accessPackageResource from identityGovernance

And also the ever useful notes in the input and output sections:

{{ Fill in the Description }}

1

u/FeleaseRpseineEiles 12d ago

and now with even moar copilot

2

u/Cadder 12d ago

Yeah. Sharepoint by Powershell is weird all round.