web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Get user profile (V2) ...
Power Automate
Unanswered

Get user profile (V2) - checking if user exists in Office365 from Excel list

(0) ShareShare
ReportReport
Posted on by

Hi there,

 

I read almost all of the "Get user profile (V2)" questions, but couldn't find an answer to this one exactly.

I'm trying to read an email from Excel and checking if an email exists in O365.

What I want to achieve is if email from Excel exists -> send an email

If email from Excel not exists -> log "bad email entry" to Excel

 

It is easy as long as email exists, but when an email does not exists, this is error what I get and I cannot extrapolate bad request and log bad email back to excel into a column.

 

Please take a look at the screenshots below.

I'm checking if "Employee EMAIL" exists, if so -> put it in the "Correct Email" column, otherwise in the "Incorrect Email"

 

Bad request output

{"statusCode":404,"headers":{"Transfer-Encoding":"chunked","Vary":"Accept-Encoding","Strict-Transport-Security":"max-age=31536000","request-id":"fdc19193-f001-43e3-bb17-fa208e6efbae","client-request-id":"fdc19193-f001-43e3-bb17-fa208e6efbae","x-ms-ags-diagnostic":"{\"ServerInfo\":{\"DataCenter\":\"West Europe\",\"Slice\":\"E\",\"Ring\":\"5\",\"ScaleUnit\":\"002\",\"RoleInstance\":\"AM2PEPF00005DCA\"}}","Timing-Allow-Origin":"*","x-ms-apihub-cached-response":"true","Date":"Mon, 12 Apr 2021 07:36:42 GMT","Content-Type":"application/json","Content-Length":"284"},"body":{"error":{"code":"ResourceNotFound","message":"User not found","innerError":{"date":"2021-04-12T07:36:43","request-id":"fdc19193-f001-43e3-bb17-fa208e6efbae","client-request-id":"fdc19193-f001-43e3-bb17-fa208e6efbae"}}}}

 

1.PNG2.PNG

 

 

Categories:
I have the same question (0)
  • fchopo Profile Picture
    8,003 Moderator on at

    Hi @Anonymous 

    You could capture if there's an error in the "get user profile" action and send it to Excel:

     

    runafter.png

     

    failed.png

     

    In this way, the "add row into a table Excel" action will be executed only if there's an error in the "Get user profile" action.

    Hope it helps!

    Ferran

  • Community Power Platform Member Profile Picture
    on at

    Hi @fchopo

     

    I did as you explained and it's a partial solution.

    What happens is next -> it fills in excel sheet with the results, but gives me a run fail status anyways - because it is either waiting for (success or fail) status.

    I think there should be a control in place before, but don't know how to do it with the output of the Get User Profile Output.

     

     

    a1.PNGa2.PNGaa.PNGaaa.PNG

  • fchopo Profile Picture
    8,003 Moderator on at

    If you want to avoid this, I would recommend you change the flow, and instead of using "Get user profile", call "Search for users":

    existinguser.png

     

    1) Search for the user

    2) If number of items is greater than 0

      2.1) Get the first user's found email

      2.2.) Add row into Excel

    3) If not exists -> Add another row into Excel

     

    Hope it helps!

    Ferran

     

  • Community Power Platform Member Profile Picture
    on at

    @fchopo 


    For some reason this is still not working

    I have tried with one correct email, and with another incorrect using your suggestion with len, but no success.

     

    ff1.PNGff2.PNG

  • Verified answer
    fchopo Profile Picture
    8,003 Moderator on at

    Hi @Anonymous 

    Sorry, I made a mistake and the correct expression in the condition should be:

    length(outputs('search_for_users_v2))

    And in the compose action would be:

    first(outputs('search_for_users_v2))?['email']

    Hope it helps!
    Ferran

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard