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

Community site session details

Session Id : mGApD3Lo2fqohIzP92/H6+
Power Apps - Building Power Apps
Answered

Using AzureAD.GetGroupMembers and Office365Users.UserProfileV2 Together

Like (0) ShareShare
ReportReport
Posted on 15 Apr 2022 10:40:30 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!

I have the same question (0)
  • Verified answer
    v-xiaochen-msft Profile Picture
    on 18 Apr 2022 at 07:01:05
    Re: Using AzureAD.GetGroupMembers and Office365Users.UserProfileV2 Together

    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 18 Apr 2022 at 17:41:34
    Re: Using AzureAD.GetGroupMembers and Office365Users.UserProfileV2 Together

    @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
    on 19 Apr 2022 at 02:13:51
    Re: Using AzureAD.GetGroupMembers and Office365Users.UserProfileV2 Together

    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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 629 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 397 Super User 2025 Season 2

#3
wolenberg_ Profile Picture

wolenberg_ 232 Moderator

Last 30 days Overall leaderboard
Loading started
Loading complete