Forum Discussion
buszi99
May 17, 2024Brass Contributor
Get site owers
Hi, I want to get site owners for all sites in SPO. How to make it. I don't want to get users in "XXX site owners" but these owners
Do you know how to make that?
Best regards,
Kamil
- KotiReddyBrass ContributorHellow, Your screenshot is related to Sharepoint which is connected to groups.
Owners > Refers to group owners to get this you can use get-pnpmicrosoft365group : https://pnp.github.io/powershell/cmdlets/Get-PnPMicrosoft365Group.html#example-7
Use example 7 to get required data. Mark this as best response if this helps to get required data.- buszi99Brass ContributorHello, when I try to get this via HTTP request to GRAPH API i get users group called "Owners XXX site", but when i go to 1st tab from screemshot i see 2 users not gruoup. I want to get these 2 users.
- KotiReddyBrass Contributorcan you share which request you are using.
As long as we use any query to pull site owners it gives group name becuase it is connected to group. You must use group member graph API: https://learn.microsoft.com/en-us/graph/api/group-list-members?view=graph-rest-1.0&tabs=http
Group Id you can get from site properties.