0
votes

I am trying to get site collection admin using Graph API, tried below query Query: https://graph.microsoft.com/beta/sites/{Site-id}?$select=*,drive&$expand=drive but I am getting single user in result though I have multiple site admins in site collection

Please find the result in below screenshot https://i.stack.imgur.com/fWxNY.png

How do I get all site collection admins using Graph api? Using Pnp js I am getting all site collection admins(users) by applying filter as 'isAdmin eq true' but here I am getting only users not group, I need to display all users and groups with expanded user, present in site collection administrators, in panel(spfx).

1

1 Answers

0
votes

As far as I know, Graph Api doesn't support get site collectiton administrators currently. You could submit the feature request here: https://techcommunity.microsoft.com/t5/microsoft-365-developer-platform/idb-p/Microsoft365DeveloperPlatform

Currently, you have to use PnPjs to get site admins:

  const users = await sp.web.siteUsers();
  const result=users.filter(ele=>ele.IsSiteAdmin===true)
  console.log(users);