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 Azure AD group f...
Power Apps
Unanswered

Using Azure AD group for filling gallery data

(0) ShareShare
ReportReport
Posted on by 26

Hi,

Who can help me out?

I now have a telephonebook with a gallery and a searchbox with filters (acountenabled and 2 countries). It's working when searching. But it's not showing everybody when the text field is empty (and this is not possible when filtering on country) 😞


I was thinking, we have in Azure AD a group called "SIG-BX-ActiveUsers-AAD" with .id "539cfb89-9d31-41fc-a414-1cb8b5f9abac" and there are the people already on country filtered.

Can we use this group to do the trick?


Can someone help me out with that?

 

Formula for the gallery is now (and within the gallery using for example ThisItem.DisplayName :

 

Sort(
Filter(
Office365Users.SearchUser(
{searchTerm: TextInput1.Text} );
AccountEnabled && (Country = "Netherlands" || Country = "Belgium")
);
DisplayName
)

 

I attached the form so you have an idea for how it looks now (one filled with name and one empty box)

filled with name.png
empty app.png
Categories:
  • v-qiaqi@microsoft.com Profile Picture
    Microsoft Employee on at

    Hi @Kloppie,

    Modify your formula as below:

    If(!IsBlank(TextInput1.Text),
    Sort(
    Filter(
    Office365Users.SearchUser(
    {searchTerm: TextInput1.Text} );
    AccountEnabled && (Country = "Netherlands" || Country = "Belgium")
    );
    DisplayName
    ),
    Sort(
    Filter(
    Office365Users.SearchUser(
    {searchTerm: "",top:999} );
    AccountEnabled && (Country = "Netherlands" || Country = "Belgium")
    );
    DisplayName
    )
    )
  • Kloppie Profile Picture
    26 on at

    @v-qiaqi-msft 

     

    Thanks, but no, I tried that and is given only 3 members, the fault is the filter on country.
    My original formula is working when I do not filter on country. Then all people are displayed, also from other countries. 
    So that's why I'm asking how to use in this form the Azure AD group where the filters are aklready are used 🙂

     

  • v-qiaqi@microsoft.com Profile Picture
    Microsoft Employee on at

    Hi @Kloppie,

    Then you need to tell us if you want to display all the users without any filter if the TextInput is blank.

    If so, remove the country filter, which will do.

     

    I don't suggest you use two different data structure in the same if statement, that's why I use the Office365User() still.

     

    If you insist on your AzureAD(), you should try as below.

    If(
     !IsBlank(TextInput1.Text),
     AddColumns(Sort(Filter(Office365Users.SearchUser({searchTerm: TextInput1.Text} );AccountEnabled && (Country = "Netherlands" || Country = "Belgium"));DisplayName),
     "Name",
     DisplayName
     ),
     AddColumns(
     AzureAD.GetGroupMembers("539cfb89-9d31-41fc-a414-1cb8b5f9abac").value,
     "Name",
     displayName
     )
    )

     

  • Kloppie Profile Picture
    26 on at

    Hi @v-qiaqi-msft ,

    I want to display all users from the 2 countries and accountenabled when text box is not filled.

    But this is not working when I use the filter on Country, so I'm searching for a solution for that problem.

     

    I thought maybe we can use the Azure AD group to get the results in ALL the fields in the printscreen (using ThisItem.xxxxx)

     

    I tried the formula as you mentioned above and I'm getting red  crosses (I replaced al "," for ";") 🙂

  • v-qiaqi@microsoft.com Profile Picture
    Microsoft Employee on at

    Hi @Kloppie,

    You are right that you need to replace all the comma "," with semi colon";".

    Have you connect to the AzureAD connector in your app?

     

    You should show me the specific error message, a screenshot is necessary.

     

    Further, I don't know how you write the first formula I provided in your scenario, it will return all the users meeting your country filtering condition if you set the top paramter as 999.

     

    Please do check my second reply formula and compare it with yours.

     

     

  • Kloppie Profile Picture
    26 on at

    Hi @v-qiaqi-msft ,

     

    If we could this working with the 1st formula you've given it would be the nicest thing ever 🙂
    I included screenshots for that one...
    Only displaying 3 items 😞

     

    It looks like the country filter is getting in the way, cause if I don't use this one in the filter it is displaying all countries. But I need only Belgium and Netherlands users 🙂

    app using top 999.png
  • v-qiaqi@microsoft.com Profile Picture
    Microsoft Employee on at

    Hi @Kloppie,

    I mean the error message of the fomrula related to the AzureAD() function😂, please try to attach needed info in the same response.

     

    If the original formula could not work, we could directly move on and focus on the next direction.

  • Kloppie Profile Picture
    26 on at

    Hi @v-qiaqi-msft ,

    Ok I now connected the Azure AD with my account.

    Used the formula and get this resultapp using AzureAD.pngapp faults.png

    freely translated The function xxxx is nokt valid xxxx is not regonized...

  • v-qiaqi@microsoft.com Profile Picture
    Microsoft Employee on at

    Hi @Kloppie,

    The formula works, however, as I mentioned before, you need to re-configure your data structure because AzureAD() and Office365Users() has different data structure.

     

    This is returned result from Office365Users():

    vqiaqimsft_0-1692868764830.png

    This is returned result from AzureAD():

    vqiaqimsft_1-1692868833536.png

     

    That's why I add a new column Name to display the displayname of the returned table represently by AzureAD() and Office365Users().

    If you want to display it in a Gallery including several fields like displayname, email, counrty, you need to add other columns like Email, Country as you expect, please note to refer to correct column name from different connectors.

     

    Eg, displayname is named as DisplayName in Office365Users(), mail is named as Mail in Office365Users().

     

    So that when you display dependent field in labels, you should refer to the new added column name from the AddColumns().

     

    Hope the above makes sense for you.

  • Kloppie Profile Picture
    26 on at

    Ok this makes some sense...

    But how do I add the other columns then, using the following in Office365 (at order of my columns ;-)):
    *Photo 
    If(
    IsBlank(ThisItem.Id);
    "";
    If(
    Office365Users.UserPhotoMetadata(ThisItem.Id).HasPhoto = true;
    Office365Users.UserPhoto(ThisItem.Id);
    "")
    )

    *ThisItem.DisplayName

    *ThisItem.Department

    *ThisItem.JobTitle

    *ThisItem.OfficeLocation

    *Telefoon If(
    !IsBlankOrError(ThisItem.UserPrincipalName) And !IsBlankOrError(Office365Users.UserProfileV2(ThisItem.UserPrincipalName).businessPhones);
    Text(
    First(Office365Users.UserProfileV2(ThisItem.UserPrincipalName).businessPhones).Value;
    "[$-en-US] (###) ###-####"
    )
    )

    *ThisItem.mobilePhone

     

    Thanks a LOT!

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 234 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 207 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 169

Last 30 days Overall leaderboard