cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Joe_100
Helper I
Helper I

Get list of groups

Hi all,

 

I am looking for a way to list all groups (mainly distribtution groups).

 

The group connector only works to list the members of a specific group, but first i want to retrieve alll groups.

 

Any method to do this? (i saw there are some possibilties through ms graph, but are there no other ways?)

 

thanks

1 ACCEPTED SOLUTION

Accepted Solutions

Hi,

 

I can't guarantee that every user belongs to a group.

 

So i will go with the custom connector to graph, but will setup a flow that uses this custom connector that will upload the groups to a Sharepoint list.

 

In PowerApps i will use the Sharepoint list.

 

Eventually this will save some licenses 🙂 

View solution in original post

8 REPLIES 8
v-xida-msft
Community Support
Community Support

Hi @Joe_100 ,

Could you please share a bit more about your scenario?

Do you want to list all groups (including Distribution List groups) which you are a member of within your app?

Further, which connector do you use within your app?

 

If you want to list all groups (including Distribution List groups) which you are a member of within your app, I think the Azure AD connector could achieve your needs.

I have made a test on my side, please take a try with the following workaround:5.JPG

 

6.JPG

Set the OnSelect property of the "Collect Groups" button to following:

ClearCollect(
AllGroups,
AddColumns(
AzureAD.GetMemberGroups(User().Email,false).Value,
"GroupName",
AzureAD.GetGroup(Value).displayName
)
)

On your side, you could consider set the OnStart property of the App control or OnVisible property of the first screen of your app to above formula.

Add a ComboBox control, set the Items property to following:

AllGroups

Please check the following GIF screenshot for more details:Test.gif

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi,

 

Unfortunetaly, i need not only groups that i am member off.

 

A little more info. I am building an application which has a part that allows the user to send an email.

Basically i am looking for a way to get the global address book including distribution groups to into the app.

 

ok, think i have a workaround.

 

I created a custom connector with Azure/MS Graph so i can retrieve all groups.

 

Unfortunetly i am the only user with a plan 1 powerapps license (other users have the plan that is included in E3?) so the other users can't use this connector inside powerapps?

 

I will now create a flow that will upload all groups and id's to a Sharepoint list and in Powerapps i will connect to the Sharepoint list.

Hi @Joe_100 ,

Could you please share a bit more about the global address book that you mentioned?

Do you want to get all groups (including Distribution list) in your tenant within your app?

 

If you want to get all groups (including Distribution list) in your tenant within your app, please take a try with the following workaround:

You need to add a Office 365 Users connection within your app firstly. Then set the OnStart property of the App control to following:

ForAll(
       Office365Users.SearchUser({top:500}),
       If(!IsEmpty(AzureAD.GetMemberGroups(Mail,false).Value), Collect(GroupIDs, AzureAD.GetMemberGroups(Mail, false).Value))
);
ClearCollect(
             AllGroups,
             AddColumns(Distinct(GroupIDs, Value), "GroupName", AzureAD.GetGroup(Result).displayName)
)

Add a Data Table control, set the Items property to following:

AllGroups

enable the GroupName field within the Data Table.

Note: I assume that each user in your tenant belongs to one group at least. If there is one user does not belong to any group, above formula would execute fail.

 

If above solution could not work on your side, as an alternative solution, you could consider create a custom connector based on Microsoft Graph API within your PowerApps to achieve your needs.

More details about creating a custom connector based on Microsoft Graph API within PowerApps, please check the following blog:

https://gotoguy.blog/2017/12/17/access-microsoft-graph-api-using-custom-connector-in-powerapps-and-f...

More details about "List groups" action of Microsoft Graph API, please check the following article:

https://docs.microsoft.com/en-us/graph/api/group-list?view=graph-rest-1.0&tabs=cs

Note: Based on the needs that you mentioned, I think the custom connector may be the better way for your scenario.

 

Currently, if the user wants to use Custom connector within PowerApps or Microsoft Flow, the user must own PowerApps Plan 1 license or Microsoft Flow Plan 1 license at least.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi,

 

I can't guarantee that every user belongs to a group.

 

So i will go with the custom connector to graph, but will setup a flow that uses this custom connector that will upload the groups to a Sharepoint list.

 

In PowerApps i will use the Sharepoint list.

 

Eventually this will save some licenses 🙂 

View solution in original post

Hi @Joe_100 ,

Yeah, I agree with your thought almost. I think the custom connector would be the better solution for your scenario.

 

Please take a try to create a custom connector in PowerApps or Microsoft Flow based on Microsoft Grpah API to achieve your needs. If you have solved your problem, please go ahead to click "Accept as Solution" to identify this thread has been solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @Joe_100 ,

Have you solved your problem?

 

If you have solved your problem, please go ahead to click "Accept as Solution" to identify this thrad has been solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

This will get only DL which the user is belongs to , but is there any possiblility to get the AZ groups by its name instead of object/groupid??

 

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (1,118)