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 / Filtering users to exc...
Power Apps
Answered

Filtering users to exclude shared and admin accounts - Manager returning error

(0) ShareShare
ReportReport
Posted on by 18

In my gallery, I only want to list "real users" - so no shared mailboxes, admin accounts etc.  I filter by looking to see if the users have managers, which works OK to exclude the unwanted accounts, except that I get errors logged in the Power Apps interface.  I think that's because the Manager function returns an error (404) when there is no manager.

 

This is my code:

If(!IsBlank(Trim(TextInputSearchUser.Text)),
 Filter(Office365Users.SearchUser({searchTerm:Trim(TextInputSearchUser.Text)}), !IsBlank(Office365Users.Manager(Id))))

 

Should I just accept the errors (they don't appear to the end user I think), or is there a neater way?

 

Thanks

 

T

Categories:
I have the same question (0)
  • v-jefferni Profile Picture
    Microsoft Employee on at

    Hi @trush ,

     

    Could you please share the detail about the error prompts? Is it says “No manager found for the specified user” ?

     

    If it is, this is the limitation of the Office365Users Connection (or saying the service). If there is no Manager for the corresponding user ID, then the Office365Users.Manager() function would throw the error.

     

    There is already an idea with the status “Under Review”:

    https://powerusers.microsoft.com/t5/Power-Apps-Ideas/Error-handling-inside-PowerApps-Try-Catch/idi-p/119311.

     

    On your side, since the users without manager is changing constantly (I suppose), there is no good way to kill the error by far. As it returns correct results, you could accept it and wait for the updates later.

     

    Hope it helps.

     

    Best regards,
    Community Support Team _ Jeffer Ni
    If this post helps, then please consider Accept it as the solution  to help the other members find it.
  • trush Profile Picture
    18 on at

    Yes, it's a 404 that there is no manager.

     

    It works in preview, I'll publish it and hopefully all will be ok.

     

    I really think that isBlank should cope with errors like this.

     

    Many thanks

     

    T

  • trush Profile Picture
    18 on at

    So, I have published it and it works fine, but the error message appears on the screen.  Is there any way I can suppress these messages?

  • trush Profile Picture
    18 on at

    I've also modified the code to use the IsBlankorError function to filter out, but that does not suppress the error messages either.  Why would IsError or IsBlankorError not stop errors being raised?

  • v-jefferni Profile Picture
    Microsoft Employee on at

    Hi @trush ,

     

    As I said, this is the limitation of the Office365Users Connection. When a user has no manager, the Office365Users.Manager(UserId) retrieves null value which is not supported in Power Apps, this occurs the error prompt. 

     

    If you don't have dynamic list of users who have not been assigned a manager, you could try to assign a solid account such as an Admin as the manager to them, then filter out users with manager not be that account.

     

    It is not a good workaround for you since its limitation, but may helpful to other users who may be seeing this.

     

     

    Best regards,
    Community Support Team _ Jeffer Ni
    If this post helps, then please consider Accept it as the solution  to help the other members find it.
  • Verified answer
    trush Profile Picture
    18 on at

    I've decided to use the Department property and set that to "None" for the non-person users.  This seems to work well and is not too great a hassle to keep up to date.

     

    If(
     !IsBlank(Trim(TextInputSearchUser.Text)),
     Filter(
     Office365Users.SearchUser({searchTerm: Trim(TextInputSearchUser.Text)}),
     !IsMatch(
     Office365Users.UserProfileV2(Id).department,
     "None"
     )
     )
    )

     

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 Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 421

#2
Valantis Profile Picture

Valantis 405

#3
timl Profile Picture

timl 337 Super User 2026 Season 1

Last 30 days Overall leaderboard