How to search users from Office365 in Power Apps Canvas app

We are all aware of Office365 Users connector through which we can fetch details of a user from Azure AD in our Canvas apps. Personally I simply love this connector. I still remember my old ways where I would literally spent days to fetch user details from active directory and display them.

How to search users from Office365 in Power Apps Canvas app

If you are searching for a user based on email, then it’s quite easy. All you need is to use the below formula to get the user details.


Office365Users.UserProfile("<email or upn>")

But what if you need to search for multiple users based on first name or last name or for that matter anything other than email or user id?

Don’t be disappointed, there is indeed a way to find that out. Below are couple of users I have with same first name – “Jack

How to search so that we get the couple of users. Below is the code to do the same.

Set(Users,Office365Users.SearchUser({searchTerm: "Jack"}))

The searchTerm is quite powerful. It searches across all the fields and return any match which contains the specified search term.

If I would have searched for the word sparrow, I would have got similar result as well.

Hope this helped!

You will also like the below posts.

Debajit Dutta
Business Solutions MVP