Skip to main content

Notifications

Power Automate - General Discussion
Answered

Error on get User Profile

(0) ShareShare
ReportReport
Posted on by 21
Good afternoon
 
I have a list of email names which rely on get User Profile to give me the names.
 
The flow does an apply to each to get the email address and convert it to a name.
 
I have names in the list which sometimes have been removed due to leaving the company, so when the Get user details is used, sometimes it throws up an error.
 
I have a dual flow which if the error occurs, it adds a comment in the name, however i would like to do a process where the the flow checks for the presence of the address before i try to retrieve the information and get an error. 
 
The multiple errors shuts down my flow. 
 
What is the best way to approach this? Flow images are below. I look forward to hearing from you.
 
Categories:
  • Verified answer
    Ellis Karim Profile Picture
    Ellis Karim 10,547 on at
    Error on get User Profile
     
    One approach is to use the Search for users action then count (using the length function) how many users were found. A count or length greater than 0 means that users were found. (You could also set the condition to 'equal to 1').
     
     
    The Search for users action will return an array. If the search returned users, we just need the first item from the array and then we extract the DisplayName:
    first(outputs('Search_for_users_(V2)')?['body/value'])?['DisplayName']
    Sample runtime of the "Search for users" action:

    [
      {
        "Id": "5e7cd825-98dc-4cfa-bd0f-cd023d745984",
        "AccountEnabled": true,
        "BusinessPhones": [
          "+1 858 555 0110"
        ],
        "City": "San Diego",
        "Country": "United States",
        "Department": "Sales & Marketing",
        "DisplayName": "Alex Wilber",
        "GivenName": "Alex",
        "JobTitle": "Marketing Assistant",
        "Mail": "AlexW@onMicrosoft.com",
        "MailNickname": "AlexW",
        "OfficeLocation": "London",
        "PostalCode": "92121",
        "Surname": "Wilber",
        "UserPrincipalName": "AlexW@onMicrosoft.com"
      }
    ]


     
    Ellis Karim
     
     
     
     
     
     
     
     
     

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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,567

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,907

Leaderboard