Search for users (V2) Example in Power Automate Microsoft Flow

Example of Search for users (V2) action in Power Automate Microsoft Flow. Work with Search for users to search any user based on filter criteria.

I have created an Instant flow with Manual Trigger. Next, I have added the Search for users (V2) action. Here it is asking me for the search term. The placeholder text in the input mentions the type of value you can provide.

I will provide the mail with only the initial word. For example, if I have 2 email addresses -> jagdish@contoso.com and jagdish.kumawat@contoso.com. In both the email addresses, jagdish is common at the beginning. So, my search term will be jagdish.

Search for users (V2) will get me all the users who have jagdish in their profile (applies to only display name, given name, surname, mail, nickname and user principal name). If you open the advanced option, you will see the Top property.

As mentioned in the placeholder, you can limit the number of results to return. You can give 1 as the minimum value. The default value is 1000. I will leave the field blank.

Search for users (V2) produces many variables concerning the user’s profile. Some of them are mentioned below for your reference.

The output of Search for users (V2) is an array of users. If you are experienced in Power Automate, you might be aware that, {value} variable/dynamic content is of array data type. So, you need to iterate on value to get all the values inside the array.

If you want to check the output of value, you can put a Compose action. Else, we will go with iterating the value. I have also added another Compose action inside Apply to each action to print the Display name of the user.

Below is what the complete flow looks like.

Run the flow and see the output. I have 2 users having the email addresses containing jagdish in them. I will have 2 items in the array.

User 1:

User 2:

Thank you All!!! Hope you find this useful.


Leave a Reply

Up ↑

Discover more from JD Bots

Subscribe now to keep reading and get access to the full archive.

Continue reading