Power Apps: List Owners from M365 Groups with MS Graph
Introduction
Listing owners of Microsoft 365 Groups in Power Apps is a powerful way to build dynamic, admin-aware business apps. This post shows how to use the Office365Groups connector and MS Graph API to retrieve group owners and display them in your app.
Scenario
Suppose you want to:
- Find a specific M365 Group by name (e.g., “Legal Team”)
- List all owners of that group in Power Apps
- Use the results for permissions, notifications, or reporting
PowerFx Formula
Here’s how to get the group ID, list its members, and extract owners:
// Find the group ID for a group whose name starts with 'Legal'
Set(
varM365GrouPId,
LookUp(
Office365Groups.ListGroups({'$filter': "startswith(displayName," & "'Legal'" & ")"}).value,
displayName = "Legal Team"
).id
);
// Get all members of the group
Set(colM365GroupUsers, Office365Groups.ListGroupMembers(varM365GrouPId).value);
// Get all owners of the group using MS Graph API
Set(colM365GroupOwners,
Office365Groups.HttpRequest(
Concatenate("https://graph.microsoft.com/v1.0/groups/", varM365GrouPId, "/owners"),
"GET", "",
{ ContentType: "application/json" }
)
);
// Extract displayName into a new table
ClearCollect(DisplayNames, AddColumns(Table(colM365GroupOwners.value), Name, ThisRecord.Value.displayName));
// Concatenate owner names into a single string
Set(varOwners, Concat(DisplayNames, Name & ", "))
How It Works
- Office365Groups.ListGroups: Returns all groups matching the filter (e.g., names starting with ‘Legal’).
- LookUp(…, displayName = “Legal Team”): Finds the exact group by display name.
- Set(varM365GrouPId, …): Stores the group ID in a variable for reuse.
- Office365Groups.HttpRequest(…): Calls the MS Graph API to get owners of the group.
- ClearCollect(DisplayNames, …): Extracts owner display names into a collection.
- Set(varOwners, …): Concatenates owner names into a single string for display or logic.
Step-by-Step Guide
- Add the Office365Groups connector to your Power App.
- Use the formula above to set the group ID, retrieve members, and extract owners.
- Display the owners in a label, gallery, or use them in logic (e.g., admin notifications).
- Customize the filter to match your group’s naming conventions.
Practical Tips
- You can filter groups by other properties (e.g., mailNickname, description).
- Use the owners collection for admin notifications, approvals, or access control.
- For large groups, consider paging or delegation strategies.
- Secure your app to ensure only authorized users can view group ownership.
- Use the concatenated string for easy display in emails or dashboards.
Example Output
Conclusion
Power Apps makes it easy to list owners from M365 Groups using the Office365Groups connector and MS Graph API. Use this pattern to build smarter, more admin-aware apps that leverage your organization’s group structure.