cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Joe_100
Level: Powered On

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
Joe_100
Level: Powered On

Re: Get list of groups

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 Smiley Happy 

7 REPLIES 7
Community Support Team
Community Support Team

Re: Get list of groups

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.
Joe_100
Level: Powered On

Re: Get list of groups

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.

 

Joe_100
Level: Powered On

Re: Get list of groups

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.

Community Support Team
Community Support Team

Re: Get list of groups

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.
Joe_100
Level: Powered On

Re: Get list of groups

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 Smiley Happy 

Community Support Team
Community Support Team

Re: Get list of groups

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.
Community Support Team
Community Support Team

Re: Get list of groups

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.

Helpful resources

Announcements
firstImage

PowerApps Monthly Community Call!

Join us next Wednesday for our Demo Extravaganza, October 16, 2019 8am PDT.

firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Top Kudoed Authors
Users Online
Currently online: 244 members 4,100 guests
Please welcome our newest community members: