Graph does not expose SPO users directly, so you have to work with the permissions. Here's a sample script I wrote a while back that you can use as starting point: https://github.com/michevnew/PowerShell/blob/master/Graph_ODFB_remove_all_shared.ps1
Remove all users from onedrive via graph powershell
Hi everyone,
When offboarding a user we don't delete their OneDrive site.
I normally use SharePoint module to remove any permissions inside that OneDrive site. But that means I add an additional user as site admin.
I want to change this to the Graph module, but it doesn't seem to be as simple as I thought. I was able to get the user's default drive and I also was able to list all children items and I found which ones have shares option. the thing is I need something that mimics the old script i.e., getting the list of all permissions in the site and remove them.
In the end my question is this - How do I transform this: ($A = get-sposite (OD); get-spouser -site $a.url | foreach {remove-spouser -loginname $_.loginname -site $a.url}) To MgGraph?
Thanks, Rahamim.