cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
tejal23
Frequent Visitor

How to Get group name

Hi,

 

I am looking to get a Security group name for the assigned user in the power app. Example User: Joe Smith Part assign to the Security group name SECADMIN  than how to get a particular group name pulled in to power app? I have tried to pull the info using the following command but not successfully.

 

Filter(Office365Groups.ListGroupMembers().value.mail=User().Email)

 

-t

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @tejal23 :

I have another alternative for your reference,It is Using Graph and Custom Connector.

Firstly,Using List memberOf

 

Get https://graph.microsoft.com/v1.0/me/memberOf

 

Can get all groups the current user belong to(inclould securtiy groups),You can use this URL to test the graph you are going to use.

Seconldy,If you want to use this command, you must call it through a custom connector

Please refer to this link

1.jpg2.JPG

Finally,Get the security group of the current user by filtering the records whose 'securityEnabled' value is true.

For Example:

Add a gallery and set it's Items property to:

Filter(ListAllGroupsInMyOrg.MyGroups().value,securityEnabled)
  • ListAllGroupsInMyOrg is my custom connector
  • MyGroups is my custom Action

3.JPG

Best Regards,

Bof

View solution in original post

8 REPLIES 8
v-bofeng-msft
Community Support
Community Support

Hi @tejal23 :

Do you want to get the group of the current user?

If so,Just use the ListOwnedGroupsV3 action of the Office365Groups connector.I've made a test for your reference:

1\Add a gallery and set it's Items property to:

 

Office365Groups.ListOwnedGroupsV3().value.displayName

 

I think this link will help you a lot:

https://docs.microsoft.com/en-us/connectors/office365groups/#actions

Best Regards,

Bof

tejal23
Frequent Visitor

Hi

 

Thank you for the update, It does not pull the Security group name. It pulls the MS Team Site group name.

 

Tejal

gabibalaban
Dual Super User
Dual Super User

 

Hi @tejal23 ,

My solution is to use AzureAD connector, which fortunately is a standard connector so you can use it without a dedicated PowerApps license .

To achive your goal, you'll interogate AzureAD to get all the groups a user is member of and put the result into a collection (Note that if you put directly to item property of a control you'll receive an error) and also add a column with the name group:

ClearCollect(allGroups,AddColumns(AzureAD.GetMemberGroups(userprincipalname or user id,true),"GroupName", AzureAD.Group(Value).displayName))

This way you can get all security groups (id and group name) a user is member of. If you change the true argument in false you'll receive all the groups a user is member of.

 

Hope it helps !

Thank you for reply,

 

I do not want to use the Azure AD connector as we have set up Two-factor Authentication. It will be painfully for a user to authenticate twice to open the App. Any other method to get security group name?

 

Thanks 

 

-T

???

There is nothing in my solution not working under MFA activated tenant. We have also MFA activated and it's working perfectly. The authorization for AzureAD connector is given only once at the first launch of the app.

Security group are visible only inside AzureAD, so I have big doubts that you find a better solution.  

 

 

Thank you, I will try it.

 

-T

Hi @tejal23 :

I have another alternative for your reference,It is Using Graph and Custom Connector.

Firstly,Using List memberOf

 

Get https://graph.microsoft.com/v1.0/me/memberOf

 

Can get all groups the current user belong to(inclould securtiy groups),You can use this URL to test the graph you are going to use.

Seconldy,If you want to use this command, you must call it through a custom connector

Please refer to this link

1.jpg2.JPG

Finally,Get the security group of the current user by filtering the records whose 'securityEnabled' value is true.

For Example:

Add a gallery and set it's Items property to:

Filter(ListAllGroupsInMyOrg.MyGroups().value,securityEnabled)
  • ListAllGroupsInMyOrg is my custom connector
  • MyGroups is my custom Action

3.JPG

Best Regards,

Bof

Thank you so much for graphs APi connector, I was able to exact the security group name. I have one query, Is it possible to pull the group names for different selected users from dropdown menu? how to send query back to graph api and get the result.

 

Thank you 

 

Tejal

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Changes to Ideas Coming

We are excited to announce a new way to share your ideas for Power Apps!

Top Solution Authors
Top Kudoed Authors
Users online (4,561)