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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Using AzureAD.GetGroup...
Power Apps
Answered

Using AzureAD.GetGroupMembers and Office365Users.UserProfileV2 Together

(0) ShareShare
ReportReport
Posted on by

Greetings.

 

I have several collects that I use to build a directory, based off of Azure AD groups set up for branches within my organization, which run at app OnStart.

 

Collect(colBranch1,AzureAD.GetGroupMembers("GUID1").value);
Collect(colBranch2,AzureAD.GetGroupMembers("GUID2").value);
Collect(colBranch3,AzureAD.GetGroupMembers("GUID3").value);
Collect(colBranch4,AzureAD.GetGroupMembers("GUID4").value);
...

 

I have a Button1 on Screen1 that is set as follows:

 

//Combine collections
ClearCollect(divDirectory,colBranch1,colBranch2,colBranch3,colBranch4);
//Create new collection with Office365User.UserProfileV2 info
ClearCollect(divDirectory2,ForAll(divDirectory.id,Office365Users.UserProfileV2(ThisRecord.id)));

 

 

 

When I set Gallery3 datasource to divDirectory2, the only thing that is missing is the UserPhoto.  Is there a way to pull in the user's photo into the collection?  Currently have an image added to each datacard in the gallery that is set as follows:

 

Office365Users.UserPhotoV2(ThisItem.id)

 

It would be nice to have all of this information in one collection.  To be clear, I would like to add the UserPhotoV2 for each user to the divDirectory2 collection.

 

I appreciate any help!

Categories:
  • Verified answer
    v-xiaochen-msft Profile Picture
    Microsoft Employee on at

    Hi @john3j ,

     

    Please try this:

    ClearCollect(divDirectory2,AddColumns( ForAll(divDirectory.id,Office365Users.UserProfileV2(ThisRecord.id)),
    "Value",
    Office365Users.UserPhotoV2(ThisRecord.id)
    )
    );

     

    Best Regards,

    Wearsky

  • john3j Profile Picture
    on at

    @v-xiaochen-msft - Is there a way to combine this with the Distinct function to remove duplicate records based on displayName?

  • v-xiaochen-msft Profile Picture
    Microsoft Employee on at

    Hi @john3j ,

     

    Yes. But in which step do you want to add distinct?

     

    Best Regards,

    Wearsky

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 395 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 260 Most Valuable Professional

Last 30 days Overall leaderboard