Live training: next batches coming soon. Join the waitlist:Waitlists open:Developer Training →Developer →Copilot Studio Training →Copilot Studio →

Check If A User Exists In Organization Through Power Apps Office 365 Users

Yesterday, I implemented a client task: how to avoid saving duplicate employee names in the SharePoint list through Power Apps.

In that case, I was required first to check whether the user existed in the organization through a Power Apps connector called Office365Users. If the user/employee name exists in the Office 365 users, it will appear in the Combo box; otherwise, it won’t.

In this article, I will explain how to check if a user exists in organization through Power Apps Office 365 Users. Also, we will discuss how to check if a user exists from a SharePoint list person field using Power Apps.

Check If A User Exists In Organization Through Power Apps Office 365 Users

Maybe you are wondering about it after seeing the screenshot below! Yes, it’s the correct picture only.

Here, there is a Power Apps Text input control and a Button. When the user provides any Employee Email address (from Office 365) and taps on the CHECK button, it will return a true or false value based on the user’s existence.

In Power Apps Office 365 Users, to check whether a user exists, it returns a boolean value of “true” if the user doesn’t exist and “false” if the user does.

Check If A User Exists In Organization Through Office 365 Users

1. Add a Text input and a Button control in the app to achieve this. Now, create a variable on the Button’s OnSelect property as: [Also, you can provide the code below either the App’s OnStart or the Screen’s OnVisible property]

Set(
    varValidUser,
    IsEmpty(Office365Users.SearchUser({searchTerm: txtEmployeeEmail.Text}))
);

Where,

  • varValidUser = Variable Name
  • txtEmployeeEmail = Text input control name

NOTE:

Ensure to add the Power Apps Office365Users connector to the app before applying the above code to avoid any errors.

Check If A User Exists In Organization Through Power Apps Office 365 Users

2. Insert a Label control and place it at the top of the text input box. Provide the variable name on its Text property as:

"User Exists - " & varValidUser
How to Check If A User Exists In Organization Through Power Apps Office 365 Users

3. Save, publish, and preview the app. In the text box, enter any Employee Email ID (from Office 365) and click CHECK. Depending on the employee’s existence, the app will return either a true or a false value. If it returns false, then the user exists; if it returns true, then the user does not exist.

Power Apps Check If A User Exists In A SharePoint List Person Field

Next, let’s discuss how to use Power Apps to check if a user exists in a SharePoint Person field.

1. I have a SharePoint list named Employee Survey Form, with all the fields below and a Person field.

ColumnData type
Employee Full NamePerson
Employee EmailSingle line of text
Contact NumberNumber
Current LocationChoice [Australia, Brazil, Canada]
AgeNumber

Refer to the image below.