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 / Employee Directory : S...
Power Apps
Unanswered

Employee Directory : Search by Name or Department

(0) ShareShare
ReportReport
Posted on by 54

Created a company directory. I want a user to be able to search employees by name or department.

 

In this formula, I want the user to be able to search for the employee by first name or department by entering the information in a single text box. However the formula doesn't work

 

If( !IsBlank(Trim(TextSearchBox1.Text)), FirstN( Filter( Office365Users.SearchUser({ searchTerm: TextSearchBox1.Text, top: 999 }), Or( !IsBlank(Department), First(Lower(Split(DisplayName, " "))) = Lower(Trim(TextSearchBox1.Text)) ) ), 15 ) )

Categories:
I have the same question (0)
  • bgreen1 Profile Picture
    54 on at

    If(
    !IsBlank(Trim(TextSearchBox1.Text)),
    Filter(
    Office365Users.SearchUser(
    {
    searchterm: "",
    top: 999
    }
    ),
    !IsBlank(Department),
    (TextSearchBox1.Text in DisplayName || TextSearchBox1.Text in Department)
    )
    )

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

    Hi @bgreen1 

     

    Please try :

    If(
    !IsBlank(Trim(TextSearchBox1.Text)),
    Filter(
    Office365Users.SearchUser(
    {
    searchterm: "",
    top: 999
    }
    ),
    !IsBlank(Department)&&
    (TextSearchBox1.Text in DisplayName || TextSearchBox1.Text in Department)
    )
    )

     

    Best Regards,

    Levi

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

    Hi @bgreen1 

     

    Your formula looks correct.

     

    Best Regards,

    Levi

  • bgreen1 Profile Picture
    54 on at

    think this is the issue. might you know how to get more the 999 users ?

     

    https://powerusers.microsoft.com/t5/Building-Power-Apps/GET-ALL-USER-FORM-OFFICE-365/m-p/1582423

  • bgreen1 Profile Picture
    54 on at

    do you know how to include more than 999 in the search?

  • bgreen1 Profile Picture
    54 on at

    If(
    !IsBlank(Trim(TextSearchBox1.Text)),
    FirstN(
    AddColumns(
    Office365Users.SearchUser(
    {
    searchterm: "",
    top: 500
    }
    ),
    "PageIndex", 1
    ),
    999
    ),
    Filter(
    AddColumns(
    Office365Users.SearchUsersNextPage(
    First(Filter(Office365Users.SearchUser({searchTerm:"",top:1}), true)).Id,
    FirstN(
    Filter(
    AddColumns(
    Office365Users.SearchUser(
    {
    searchterm: "",
    top: 500
    }
    ),
    "PageIndex", 1
    ),
    !IsBlank(Department),
    (TextSearchBox1.Text in DisplayName || TextSearchBox1.Text in Department)
    ),
    499
    ),
    First(Filter(Office365Users.SearchUser({searchTerm:"",top:1}), true)).Value
    ),
    "PageIndex", 2
    ),
    !IsBlank(Department),
    (TextSearchBox1.Text in DisplayName || TextSearchBox1.Text in Department)
    )
    )

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

    Hi @bgreen1 

     

    This link points to how to search beyond the 999 limit:

    Solved: Re: GET ALL USER FORM OFFICE 365 - Power Platform Community (microsoft.com)

     

    Best Regards,

    Levi

  • bgreen1 Profile Picture
    54 on at

    Yes with formula below can I search beyond 999 limit ?

    If(
    !IsBlank(Trim(TextSearchBox1.Text)),
    Filter(
    Office365Users.SearchUser(
    {
    searchterm: "",
    top: 999
    }
    ),
    !IsBlank(Department)&&
    (TextSearchBox1.Text in DisplayName || TextSearchBox1.Text in Department)
    )

     

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

    Hi @bgreen1 

     

    This formula cannot exceed the limit of 999.

     

    Best Regards,

    Levi

  • bgreen1 Profile Picture
    54 on at

    Is it possible to create a formula to exceed the 999 limit ?

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 551

#2
WarrenBelz Profile Picture

WarrenBelz 430 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 298

Last 30 days Overall leaderboard