In this PowerApps Tutorial, we will discuss how to get users from Office 365 group in PowerApps. We can easily get the information of a user from a specific SharePoint group in PowerApps.
Powerapps get user group membership
Normally, When you work with Powerapps to get the User’s information from a SharePoint Group, Most of the people are using Microsoft Powerapps Flow.
Yes, you can use Microsoft Flow undoubtedly, but there is also the easiest and tricky way to get the user from the SharePoint group without using Microsoft Flow.
You can get the SharePoint Group Members directly using the PowerApps Office 365 Groups connector.
The below screenshot represents a Microsoft Office 365 SharePoint Group named PowerAppsGroup. This SharePoint group contains only two Members as shown below.
I want to get and display these two users information in the Powerapps screen.
Powerapps list group members
- Sign in the PowerApps app with your credentials.
- Create a blank new Canvas app and choose any one Layout either Tablet or Phone.
- First of all, you need to add the Office 365 Groups connector to the Powerapps screen.
- Go to View tab -> Data sources -> Search Office 365 Groups in the search box -> Add a new connection or existing connection as below.
- On the PowerApps screen, insert a Button (Insert -> Button). Select the Button and set its Text property as “Get Group Members from SharePoint Group“.
- Select the Button and apply this below formula on its OnSelect property as:
OnSelect = ClearCollect(SharePointGroupMembers,Office365Groups.ListGroupMembers("1dfb19e0-25fc-44a6-8016-f92a064d1d34").value)
- ClearCollect = This function helps to create Powerapps collection where it will clear all the previous data and always store the new one.
- SharePointGroupMembers = Collection Name
- Office365Groups.ListGroupMembers(“Group ID”) = It helps to get the information about all the users from the specific SharePoint Group
If you are new to Powerapps Collection, then refer these below articles:
- How to create and use PowerApps Collection
- PowerApps Collection: Add, Update, Remove and Filter items
Follow this below content to find out the SharePoint Group ID.
You can get any SharePoint Group ID by using three different ways:
- Get SharePoint Group ID from Group itself
- Get Group ID from any SharePoint Groups
- Get Group ID from Azure Portal
- Get SharePoint Group ID from Group itself
Follow the below steps to retrieve the SharePoint Group ID from the SharePoint group itself:
- Open any existing SharePoint Site and hit on the Gear icon from the right top of the page.
- Click on Site permissions -> Advanced permissions settings as shown below.
- Next, it will open the page (People and Groups) where you can see all the SharePoint Groups. Click on your specific SharePoint Group that you want to get the ID.
Note:If in case, you can not see your specific SharePoint Group, then click on any group that are visible on the Permission page. From the left side navigation, click “More” options under the Groups section. Once you will click on More, you can see all the SharePoint Groups as like the below screenshot.
- Next, the SharePoint Group ID will appear as below. Just copy the Group ID (only highlighted portion) that is present in the Account section and save it in one Notepad. You can use this Group ID in your Powerapps app.
2. Get Group ID from any SharePoint Groups
Follow the below steps to retrieve the SharePoint Group ID from any SharePoint groups:
- Do the same previous steps till opening the People and Groups page.
- Open any existing SharePoint Group like “PowerApps Owners” and add a group as a user or member over there. Select New -> Add Users as shown below.
- Select Invite people -> Enter the SharePoint Group name (PowerAppsGroupMembers) that you want to get the ID -> Click on the Share button.
- Next, the SharePoint Group will be added as a user into the PowerApps Owners group. Once you will click on the group, then you can see the Group ID in the Account section as shown below.
- Just copy the Group ID and paste it in a Notepad. Later, use this group ID in your Powerapps app to get the User details.
3. Get Group ID from Azure Portal
- Open your Azure Portal and Search for Groups in the search box.
- Select the specific group for more information.
- You can see the Group ID in the Object Id field. Just copy the ID and paste it in one Notepad. You can use this ID in your Powerapps app.
To display all the Group Members’ information, We need to add a PowerApps Gallery control on the Powerapps screen.
- Insert a Gallery control (Insert -> Gallery -> Vertical).
- Add the Collection Data source (Select the Gallery -> Properties -> Data source -> SharePointGroupMembers) in the Gallery control. The Collection that you have created in the Button control above.
- Select the Gallery control Layout as Title and Subtitle.
- Edit the Fields and provide these below options:
- Title: displayName
- Subtitle: mail
- Now just Preview (F5) the Powerapps app and hit on the Button (Get Group Members from SharePoint Group).
- In the Gallery control, you can see all the User Display Name and Email those are present in the specific SharePoint Group.
- Next, go to the PowerApps Collection (View -> Collections) where the user information has been stored.
Also, you may like these below PowerApps Tutorials:
- PowerApps role based security SharePoint example
- PowerApps: Submit data to two SharePoint Lists
- PowerApps Patch Function with examples
- PowerApps Validation: 9 Examples [Required Field, Email, Date, URL, Password, Number, ZIP]
- PowerApps set field value based on another field
- Show hide fields based on dropdown selection PowerApps
- Embed PowerApps in SharePoint modern page
- PowerApps toggle control + How to use with example
- How to use date time picker in PowerApps
- PowerApps Search Function + How to use with example
- PowerApps Combobox Control
In this PowerApps Tutorial, We discussed how to get users from a specific SharePoint group in PowerApps.
Also, We saw how to get the Group ID from SharePoint using different ways and display all the SharePoint Group members using the Powerapps Gallery control.
I am Bijay a Microsoft MVP (8 times – My MVP Profile) in SharePoint and have more than 15 years of expertise in SharePoint Online Office 365, SharePoint subscription edition, and SharePoint 2019/2016/2013. Currently working in my own venture TSInfo Technologies a SharePoint development, consulting, and training company. I also run the popular SharePoint website EnjoySharePoint.com