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
Solved! Go to Solution.
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"
)
)
)
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”:
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.
Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.
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
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?
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?
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.
Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.
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"
)
)
)
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
Power Platform release plan for the 2022 release wave 2 describes all new features releasing from October 2022 through March 2023.
User | Count |
---|---|
200 | |
97 | |
56 | |
51 | |
42 |
User | Count |
---|---|
263 | |
157 | |
83 | |
80 | |
57 |