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

Validate if Office 365 user exist

Hello All

i need to validat eif a user exist in office 365 i read a sharepoint list and run a "User search" but i dont know how to know if the response is empty :(, if this is empty i undesrstand the user doesnt exist else the user existe and i get his email.

 

do u know some way to validate this

4 REPLIES 4
Tom_Slosse
Memorable Member
Memorable Member

Hey @Anonymous

 

 

You could use the Search for users action to know if an user exists or not.

And then Get user profile action to get the UPN or email from the user that has been searched.

 

I recreated your Flow with your information given.

UserSearch.PNG

 

Hope this helps

 

Kind regards

 

 

Tom

 



If this reply has answered your question or solved your issue, please mark this question as answered.

Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up.

v-yuazh-msft
Community Support
Community Support

Hi @Anonymous,

 

Have @Tom_Slosse's answer solved your question?

 

Do you want to check if the response of the "User search" is empty?

 

You could use "Search for users" action to search the user,please refer to screenshot below to create the flow:

 

Capture.PNG

 

The expression in the condition as below:

@equals(length(body('Search_for_users')), 0)

 

The flow would run successfully to check if the user exists.

If the user exists, the flow would get the user's email as screenshot below:

Capture.PNG

 

If the user don't exists, the flow would do nothing as screenshot below:

Capture.PNG

 

 

 

 

Regards,
Alice Zhang

PowAuto
New Member

Solution for Finding Users Not in O365 / Not Working for the Company Anymore / Offboarding Emails

In my case the solution needed to check all registered 'Authors' and 'Owners' of documents in a Sharepoint library, find any users that were no longer working for the company, and then send alert emails so new Owners or Authors could be assigned the documents.

The challenge was getting a Compare function to match users that were not found in the O365 tenancy, as using the Search For User function simply returned an empty object, which I couldn't then get the Condition function to recognise.

PowAuto_0-1634796005112.png

 


The answer was to use Compose function with the Length expression first to render an output integer for the length of the response to the user Search, which would then allow the Condition function to operate on it.

Solution

  1. Recurrence function - so the job runs weekly 
  2. Get Items (Sharepoint) function to call the Sharepoint Library
  3. Apply to Each function, using the 'value' from the Get Items step - @{outputs('Get_items')?['body/value']} 
    1. Search For User v2 (O365), searching with an an outputted User field value from the Get Items step (in my case, Document Author Display Name)
    2. Compose function, using a Length expression to output a number - @{length(body('Search_for_users_(V2)')?['value'])}
    3. Condition function, using the Outputs from the Compose step, Is Less Than, 1. This will answer True if a user is not found in O365 as the response body's  value is empty and has 0 length.
      1. If True: Send an Email function
      2. If False: do nothing
  4. Terminate

PowAuto_0-1634795649504.png

 

Hi @v-yuazh-msft !

 

Sorry to bring back an old post, I would like to know how to changed modes in your condition. I can't find a button to change modes.

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

MPA Licensing.jpg

Ask your licensing questions at the Power Automate AMA!

Join Priya Kodukula and the licensing team, super users and MVPs to find answers to your questions on Power Automate licensing.

Users online (4,825)