0

Need to use Graph API to get SharePoint site owners in Power Automate. Able to achieve it through REST API but not finding Graph API to fetch the SharePoint owners of the site.

Can you guide?

4
  • 1
    Is this is communication site or team site connected with M365 group? May 19, 2023 at 7:53
  • Graph API calls you'll need: 1) Get your Site ID: https://graph.microsoft.com/v1.0/sites?search=YourSiteName. 2) Get owners https://graph.microsoft.com/v1.0/sites/<<LOONG,ID,HERE>>/drive
    – Popkornak
    May 19, 2023 at 11:40
  • @GaneshSanap Its a Team site connected to M365 group. Looking for how can I compsoe it May 24, 2023 at 5:08
  • In that case, you can get the M365 group owners for group associated with site using: List group owners. Let me know if it works for you. May 24, 2023 at 6:06

2 Answers 2

0

If your SharePoint online site is connected to the Microsoft 365 group, it will be easier to fetch the owners using Microsoft graph API endpoints.

You can get the M365 group owners for the group associated with your SharePoint team site using List group owners endpoint like:

GET /groups/{id}/owners

Example Response:

HTTP/1.1 200 OK
Content-type: application/json

{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#directoryObjects",
    "value": [
        {
            "@odata.type": "#microsoft.graph.user",
            "id": "4562bcc8-c436-4f95-b7c0-4f8ce89dca5e",
            "accountEnabled": true,
            "displayName": "MOD Administrator",
            "userPrincipalName": "[email protected]"
        },
        {
            "@odata.type": "#microsoft.graph.user",
            "id": "f0206b06-7c5d-461c-ae24-08f68b7ef463",
            "accountEnabled": true,
            "displayName": "Megan Bowen",
            "userPrincipalName": "[email protected]"
        },
        {
            "@odata.type": "#microsoft.graph.user",
            "id": "5c70937c-d9ea-4a47-8852-ab77630f803d",
            "accountEnabled": true,
            "displayName": "Diego Siciliani",
            "userPrincipalName": "[email protected]"
        }
    ]
}

Documentation: List group owners

0

Currently, Site resource does not expose Owner property.

As a workaround, you could get the default library owner in the site. The default library owner would be the site owner. Below is the endpoint to get the sites drive, there is an owner property in the response:

https://graph.microsoft.com/v1.0/sites/{site-id}/drive

Hope this helps. Best Wishes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.