In this Power Automate tutorial, We will discuss how to work with Power Automate Get Display Name From Email.
Also, we will see how we can attach a file or an image in a Dataverse row if the sender’s email matches the sender’s display name.
Recently I got a requirement where I needed to retrieve the sender display name from an email address using Power Automate. Let’s see how we can achieve this.
Also, Read: Power Automate Dataverse Add New Row
Power Automate Get Display Name From Email
In this section, we will explore how we can get the display names of the sender from their email addresses using Power Automate. To work around this, I have used a Dataverse table.
Scenario:
- Below represents the Dataverse table named IT Issue Resolutions. This custom table has the below fields with various data types. Such as:
- Sender = This is the Dataverse Primary column with a single line of text data type.
- Issues = Single line of text data type
- Report Date = Date Data type
- Status = Choice Column having some choices like Approved, Rejected, Pending, etc.
- Attachments = This is a File column. To know more details about the Dataverse file column, read: How to Create Dataverse File Field
- Now I want to build a flow where the sender will send an email with an attachment (file). If the sender email address contains the sender display name, then the specific file will attach in the specific dataverse row.
- For example, If Sonam sent an attachment email (Sonam@tsinfotechnologies.onmicrosoft.com), then it will filter with the display name (Sonam). And if the condition matches, then the particular file will upload in Sonam’s attachment field as shown below.
To do so, follow the instructions below.
Step – 1: [Create a new automated flow]
- Open Power Automate and Sign in with your valid Microsoft credentials.
- Go to My flows (from the left navigation) -> Expand + New flow -> Select Automated cloud flow under the Build your own from blank section.
Step – 2: [Provide Flow name and Choose the trigger]
- The window shown below will then display, asking you to enter the flow name and select the flow trigger.
- Flow name = I have given the flow name as Extract Names from Email.
- Choose your flow’s trigger = Search or select the trigger from the list below to create a flow. In my case, it’s When a new email arrives (V3).
- Click on Create.
Step – 3: [Select Include Attachments]
- Once the flow has been created, the trigger will appear as shown in the screenshot below. Expand the trigger and select Yes under the Include Attachments field.
Step – 4: [Insert Get user profile action]
- Next, we need to add a Get user profile action that will help you to retrieve the display name from the email address.
- Click on the + icon and Add an action to insert a new step below the trigger (When a new email arrives (V3)).
- Search Get user profile in the search bar -> Select Office 365 Users -> Click on Get user profile (V2) under the Actions tab.
- Expand the Get user profile (V2) action and enter the field value:
- User (UPN) = Select the field and click the From under When a new email arrives (V3) [From the Dynamic content tab].
Step – 5: [Add Get Attachment action]
- Next, Click on the + icon and add a Get Attachment (V2) action under the Office 365 Outlook section.
- Expand the Get Attachment action and enter the below field values as:
- Message Id = Select the field and click on the Message Id under When a new email arrives (V3) from the Dynamic content. When you will select the Message Id, then the Apply to each action and its value (Attachments) will add automatically.
- The below screenshot represents the Attachment Id.
- Attachment Id = Select the field and click on the Attachments Attachment Id under When a new email arrives (V3) from the Dynamic content.
Step – 6: [Insert List rows action]
- Then, under the Get Attachment (V2) action, click on the + icon and add a Dataverse List rows [PREMIUM] action.
- Once the List rows action has been added, just select the Dataverse Table name (IT Issue Resolutions) from the dropdown menu.
- In the Filter rows field, apply the code below:
contains(crf9a_sender, 'Display Name')
Where,
- crf9a_sender is the logical name of the Sender (Dataverse column).
- ‘Display Name’, you can take under the Get user profile action from the Dynamic content. In the above code, we are filtering the dataverse sender name. If the dataverse sender contains the sender display name, then the flow will proceed and upload the file.
Step – 7: [Add Upload a file or an image action]
- To upload a file to the specific sender, add an action called Upload a file or an image action under Microsoft Dataverse. Expand the action and fill in the field details below:
- Table name = Provide the Dataverse table name (IT Issue Resolutions) from the dropdown menu.
- Row ID = Select the field and click on the IT Issue Resolutions under the List rows action [from Dynamic content].
- Column name = Select the Dataverse File column name (Attachments) from the dropdown.
- Content = Select the field and click on the Content Bytes under the Get Attachment (V2) action [from Dynamic content].
- Content name = Select the field and click on the Attachments Name under the Get Attachment (V2) action [from Dynamic content].
Refer to the screenshot below.
Step – 8: [Save and Test the flow]
- Finally, Save the flow. Click the flow checker as well to see if there are any problems.
- If so, fix it. If not, move on to testing the flow. Select Test.
- Select Manually and click Test as shown below in the Test Flow pane. You must send a new email to your inbox to check whether the flow is functional or not.
Step – 9: [New email arrives]
- I sent a message (including an attachment) to my inbox using Sonam, another account, for this purpose as in the image below.
- The flow will eventually complete successfully, and a message such as “Your flow ran successfully” will show up at the top of the flow.
- At the same time, if you will expand the Get user profile (V2) action, then you can see the User (UPN) comes like “Sonam@tsinfotechnologies.onmicrosoft.com” and it extracts only the sender name, and it’s displaying in the Display Name field (Sonam Subhadarsini).
Step – 10: [Refresh the Dataverse table]
- Now come back to the relevant Dataverse table (IT Issue Resolutions) and refresh it once. You can view the email attachment that has been added to Sonam’s Attachments field in the below image.
This is how to Extract Names from Email in Power Automate.
Moreover, you may like some more Power Automate and Dataverse tutorials:
- Power automate SharePoint multiple choice column to string
- How to Get Dataverse Created by in Power Automate
- How to Upload Images to Dataverse from Power Apps
- How to Update a Row in Dataverse Using Power Automate
- Power Automate Dataverse Update Multiple Rows
- How to Patch Dataverse Choice Column in Power Apps
In this Power Automate tutorial, we discussed how to work with Power Automate Get Display Name From Email.
Furthermore, we saw how we can attach a file or an image in a Dataverse row if the sender’s email matches the sender’s display name.
I am Bijay a Microsoft MVP (10 times – My MVP Profile) in SharePoint and have more than 17 years of expertise in SharePoint Online Office 365, SharePoint subscription edition, and SharePoint 2019/2016/2013. Currently working in my own venture TSInfo Technologies a SharePoint development, consulting, and training company. I also run the popular SharePoint website EnjoySharePoint.com