“I’d like to check whether a user with specific email address exists in our company’s Active Directory, can I use Power Automate to do that?”
When you’re working with email addresses, there’s always a difference whether it’s an internal or an external address. If it belongs to a user from your company, it servers as a unique identifier of the user, something you can use in all the M365 applications to reference this user. You can get detailed information, send him emails, teams messages, assign tasks, and much more – as long as the user exists.
But how do you recognise whether it’s somebody from your company? And if this user is still active or already left?
Option 1: Use ‘Run after’ after the ‘Get user profile’ action
If you know the user email address or user id, you can use the ‘Get user profile’ action. You’ll either get the user information or an error – User not found.

But you can take it as a valid result (as when updating files) using the ‘Configure run after’ settings on the following actions.

Set the action to run after the ‘Get user profile’ has failed and define what to do when the user doesn’t exist.

Option 2: Use the ‘Search for users’ action
Another approach is to use the ‘Search for users’ action. Use the email address as the Search term and evaluate the action result.

If the result is empty, the user doesn’t exist.
The benefit of this approach is that if the user exists, you’ll get an additional information, e.g. whether the account is enabled.

Use it in a condition to make sure that the user is really available.
empty(outputs('Search_for_users_(V2)')?['body/value']) = false
and
first(outputs('Search_for_users_(V2)')?['body/value'])?['AccountEnabled'] = true

Option 3: Search for the user with an HTTP request
The last option is to use an HTTP request to the Office 365 Users. As explained in the previous article, you can search for a user using more properties than with the ‘Search for users’ action. Similarly, the HTTP request won’t fail for non-existing users, it’ll return either the user or an empty array.
Method: GET
Uri:
https://graph.microsoft.com/v1.0/users?$filter=<property> eq '<value>'
Check whether the output is empty (user doesn’t exist) or not (user exists), and continue accordingly.
empty(body('Send_an_HTTP_request')?['value'])

Summary
You’ve got three options how to check whether a user exists using Power Automate – two standard actions or an http request. With the standard actions it’s up to your preference – you can either ask for the user profile directly and take the error as a valid output, or search for the user in combination with a condition. The HTTP request will then allow you searching by any property, on the other side you must extract the user information from the response JSON.
Hi,
How can we send email to O365 group email address when it is in ‘CC’ email body from power automate. Get user profile doesn’t recognize group/distribution list email and return user not found error.
Hello Sandy,
you can just type in the email address if you know it, no need to get user profile.
I’m using get user profile for this particular flow, it has two apply to each actions and the get user profile is in the last apply to each action. It was tested and was working fine. But in production, the flow is running for hours. It’s a scheduled flow… Do you think changing it to a HTTP request would change that?