cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

How to check if a User exists in organization through Office365Users?

I know that Office385Users.SearchUser() returns a string, but how do I check if a User exists in the org using SearchUser? When I did IsBlank(Office385Users.SearchUser({searchTerm: text.Text}), it is supposed to return "true" if the user doesn't exist. But instead, it returned false even when the user I put in doesn't exist. Is there an alternative way to check if a user still exists in an org?

 

Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions
KrishnaV
Community Champion
Community Champion

hi @Anonymous ,

 

try this:

IsBlank(LookUp(Office365Users.SearchUserV2().value, Mail = textInput.Text).Mail)

 
I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
Krishna
If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members find it more.

 



I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
KrishnaV
Business Applications MVP, Microsoft Certified Trainer
Twitter | Linkedin | YouTube | GitHub
If this post helps you give a THUMS-UP and if it solved your issue consider Accept it as the solution to help the other members / new members of the community.

View solution in original post

3 REPLIES 3
KrishnaV
Community Champion
Community Champion

hi @Anonymous ,

 

try this:

IsBlank(LookUp(Office365Users.SearchUserV2().value, Mail = textInput.Text).Mail)

 
I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
Krishna
If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members find it more.

 



I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
KrishnaV
Business Applications MVP, Microsoft Certified Trainer
Twitter | Linkedin | YouTube | GitHub
If this post helps you give a THUMS-UP and if it solved your issue consider Accept it as the solution to help the other members / new members of the community.

IsBlank(LookUp(Office365Users.SearchUserV2().value, Mail = textInput.Text).Mail)

The solution shown above does not work for a scenario where there are more than 1000 users in the tenancy. Because SearchUserV2 function returns top 1000 users. So if the user you are looking for is not within first 1000 users then the code snippet will always return TRUE. I have used following instead:

 

 

IsEmpty(Office365Users.SearchUserV2({searchTerm:textInput.Text}))

 

 

You can use SearchUser function as well. Works for me.

Note: checking IsEmpty because SearchUser/SearchUserV2 function returns collection of User objects.

Thank you! I used IsEmpty as in your suggestion and get a nice true or false which I then use in other formulas.

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (5,837)