Power Apps: Get SharePoint Site Owners with Power Automate
Introduction
I had to display SharePoint site owners withinin Power Apps for the selected SharePoint site for the end users who to reach out for any questions on the site. It was not possible using the Office365Groups
which allows to interact with Ms Graph. I could not use the solution from https://reshmeeauckloo.com/posts/powerapps-list-owners-m365groups/ to help. I had to resort to Power Automate (Flow) with an HTTP request to SharePoint, parse the results, and return the owners to Power Apps to achieve the solution.
Example of Scenarios
- Get the list of site owners from SharePoint
- Use the owners in Power Apps for permissions, notifications, or display
- Automate the process using Power Automate and HTTP requests
Step-by-Step Guide
1. Create a Power Automate from Power Apps itself
2. Send HTTP Request to SharePoint
Add the Send an HTTP request to SharePoint action in Power Automate:
- Site Address: Your SharePoint site URL
- Uri:
/_api/web/sitegroups(3)/users
(replace3
with your Owners group ID) - Headers:
Accept: application/json
Content-type: application/json
2. Parse JSON Action
Add a Parse JSON action to process the HTTP response:
- Content:
@{body('Send_an_HTTP_request_to_SharePoint')}
- Schema: Use the provided JSON schema to extract user details (see code above).
JSON Schema Example
Use this schema in the Parse JSON action to extract all relevant user properties:
{
"type": "object",
"properties": {
"odata.metadata": {
"type": "string"
},
"value": {
"type": "array",
"items": {
"type": "object",
"properties": {
"odata.type": {
"type": "string"
},
"odata.id": {
"type": "string"
},
"odata.editLink": {
"type": "string"
},
"Id": {
"type": "integer"
},
"IsHiddenInUI": {
"type": "boolean"
},
"LoginName": {
"type": "string"
},
"Title": {
"type": "string"
},
"PrincipalType": {
"type": "integer"
},
"Email": {
"type": "string"
},
"Expiration": {
"type": "string"
},
"IsEmailAuthenticationGuestUser": {
"type": "boolean"
},
"IsShareByEmailGuestUser": {
"type": "boolean"
},
"IsSiteAdmin": {
"type": "boolean"
},
"UserId": {
"type": "object",
"properties": {
"NameId": {
"type": "string"
},
"NameIdIssuer": {
"type": "string"
}
}
},
"UserPrincipalName": {
"type": "string"
}
},
"required": [
"odata.type",
"odata.id",
"odata.editLink",
"Id",
"IsHiddenInUI",
"LoginName",
"Title",
"PrincipalType",
"Email",
"Expiration",
"IsEmailAuthenticationGuestUser",
"IsShareByEmailGuestUser",
"IsSiteAdmin",
"UserId",
"UserPrincipalName"
]
}
}
}
}
3. Apply to Each & Append to Owners
Loop through the parsed results and build a list of owner names:
- Apply to Each: Iterate over
value
array - Append to Owners:
item()?['Title'];
4. Respond to Power Apps or Flow
We can only pass scalar values to the action Respond to Power Apps or Flow
explaining why the concatenated list of owners was built before passing the output.
Return the concatenated owners string to Power Apps:
- Output:
variables('Owners')
5. Call the Power Automate Flow from Power Apps
Trigger the flow from Power Apps and display the owners in a label fiels
Practical Tips
- Make sure you have permissions to call the SharePoint API and access group membership.
- The Owners group ID (
sitegroups(3)
) may vary; check your site settings for the correct ID. - You can adapt this pattern to retrieve other groups (Members, Visitors) by changing the group ID.
- Use the returned owners for access control, notifications, or display in your app.
- Secure your flow to prevent unauthorized access to sensitive user data.
Conclusion
Power Automate makes it easy to retrieve SharePoint site owners and use them in Power Apps to get round the limitations of using the Office365Groups
directly.