web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Retrieving the AAD Gro...
Power Apps
Unanswered

Retrieving the AAD Group Teams for a connected user

(0) ShareShare
ReportReport
Posted on by 516

Hi all, 

 

I am building a canvas app connected to Dataverse. I have created Teams connected to AAD Groups to managed the users access to data. I would like to be able to retrive the information about which teams a user belongs to to show it in the app. I have seen this post https://powerusers.microsoft.com/t5/Microsoft-Dataverse/Retrieve-logged-in-User-associated-teams-in-canvas-app/td-p/1219484 that shows how to get owning groups but I can't figure out how to get AAD Groups. The only view available is "All AAD Groups". Can anyone help ?

 

Thanks

I have the same question (0)
  • v-bofeng-msft Profile Picture
    on at

    Hi @HFG ,

     

    You could try:

    vbofengmsft_0-1690339061367.png

     

     

    Office365Groups.ListOwnedGroupsV3().value

     

    or 

    vbofengmsft_1-1690339077554.png

     

     

    AzureAD.GetMemberGroups(User().Email,false).Value

     

     

    Best Regards,

    Bof

  • HFG Profile Picture
    516 on at

    Hi @v-bofeng-msft , 

     

    Thanks for your reply. 

     

    Regarding Office365.ListOwnedGroups, unless mistaken this only gets the groups that the user is the owner of. I need to list the groups the owner is a member of. I see there is the option GroupesOffice365.ListGroupMembers, but as I have 20+ teams and this amount can grow I will need to find a way to check them all dynamically. I have a table with all the AD Group GUIDs, I tried putting them all in

    a collection then using forall to get the group members but there is an error message saying the O365Groups cannot be used with ForAll.

     

    Regarding the Azure AD connector, to use it requires authorisation from an administrator and the account being used in the connector needs AD admin permissions so I think this is out of the question for us. 

     

    As my AAD groups are linked to Teams in the environment I was hoping there was a way to list all of the teams a user is the member of. 

     

    Thanks

  • v-bofeng-msft Profile Picture
    on at

    Hi @HFG ,

     

    Maybe you could use graph API to get the groups user belongs to. You could use flow or create a custom connector to invoke the graph API. It only needs read permission.

    https://graph.microsoft.com/v1.0/users/{UserEmail}/transitiveMemberOf/microsoft.graph.group

     

    vbofengmsft_0-1690360047630.png

    https://learn.microsoft.com/en-us/graph/api/user-list-memberof?view=graph-rest-1.0&tabs=http

     

    Best Regards,

    Bof

  • HFG Profile Picture
    516 on at

    HI @v-bofeng-msft , 

     

    Thanks again for your input. 

     

    I just retried Office365.ListOwnedGroupsV3 (I think I didn't used V3 the first time) and it does seem to get groups a user is the member of too, but only Office365 groups. I should have specified that the groups I'm trying to retreive are AAD Security Groups. Does this change anything for the information you haev given ?

  • Verified answer
    HFG Profile Picture
    516 on at

    I just found how to do this, here is the code. In the example I save the teams in a one column collection colTeams. I am working in French so the exact code will change. The "Utilisateurs" table in English I believe is Users (systemusers). 

     

    HFG_0-1690544880961.png

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard