We often come across a requirement wherein we need to fetch the information from the Security Group and need to display within Power Apps for Business Logic implementation.
How can we find that Group ID for the Security Group?
Step 3: Now, add Gallery Control and add Collection as a data source. This will show users in the Gallery.
Example:
Below is one of the Security Group created in Microsoft 365. Here, there are two members added to that Security Group.
Below is one of the Security Group created in Microsoft 365. Here, there are two members added to that Security Group.
In Power Apps, we need information about those two users.
Step 1: Open Power Apps Canvas App. First, we need to add Office 365 Groups Connector. For that,
- Go to View Menu, and select Data sources.
- Search for “Office 365 Groups”. Select the highlighted one and add a connector to the App.
- Once the Connector is added, this will look like this.
Step 2:
- Open Power Apps screen and add a button.
- Write the following line of code for “On Select” event of the button.
ClearCollect(MembersfromSG,Office365Groups.ListGroupMembers("GroupID").value)
- Here, MembersfromSG is the Name of the collection. Office365Groups.ListGroupMembers(“Group ID”) returns the information about all the members of that security group.
How can we find that Group ID for the Security Group?
- Open Azure Portal and search for Groups. This will open the following screen.
- Select your security group for more information.
- Copy Object Id. This is the Group ID. We can use this Group ID in the below formula. The formula will look like this.
ClearCollect(MembersfromSG,Office365Groups.ListGroupMembers("xxxxxxxx-1xxb-4x4b-xxxxxx").value)
Step 3: Now, add Gallery Control and add Collection as a data source. This will show users in the Gallery.
Conclusion:
This is how we can get the Member Information using Office 365 Groups Connector in Power Apps.