Power savage

Displaying First and Last Names from SharePoint People Picker in Power Automate

Introduction

Working with people picker columns in SharePoint can be tricky when you need to personalize communications. By default, SharePoint stores a person field as a complex object that includes display name, email, and account details. In this tutorial, we’ll show you how to extract just the first and last names from that object in Power Automate and use them in a clean, professional-looking email or document.

Why Split the DisplayName?

  • Personalization: Addressing users by their first name (or full name without extra characters) feels more personal and engaging.

  • Consistency: Automations that rely on raw DisplayName values can produce inconsistent formatting (“JohnDoe,” “Doe, John”, etc.). Splitting ensures a predictable result.

  • Data Hygiene: Removing stray commas or unexpected whitespace prevents errors in downstream actions, reports, or exports.

Prerequisites

  • A SharePoint list with a People or Person column (single selection).

  • A Power Automate flow triggered by When an item is created or modified.

Step-by-Step Instructions

1. Trigger and Get Item

  1. Trigger: Select When an item is created or modified.

  2. Get item: Add Get item (if needed) to retrieve the full person object. Use your site address, list name, and the ID from the trigger.

2. Extracting First and Last Name

Option A: Splitting the DisplayName

  1. In a Compose action (or directly in your email body), click Expression.

  2. Insert this expression to build a clean full name:

				
					replace(
  concat(
    first(split(outputs('Get_item')?['body/Person/DisplayName'], ' ')),
    ' ',
    last(split(outputs('Get_item')?['body/Person/DisplayName'], ' '))
  ),
  ',',
  ''
)
				
			
  1. This does the following:

    • split the DisplayName on spaces

    • first and last pull out the two name parts

    • concat joins them with a single space

    • replace strips out any commas

Option B: Using Office365Users.GetUserProfile (V2)

  1. Add Office 365 Users – Get user profile (V2).

  2. Pass the person column’s Mail or UPN into the User (UPN) field.

  3. In your Compose or email, use:

				
					concat(
  outputs('Get_user_profile_(V2)')?['body/givenName'],
  ' ',
  outputs('Get_user_profile_(V2)')?['body/surname']
)
				
			

Technical Details

  • split: Breaks a string into an array based on a delimiter.

  • first / last: Retrieves the first or last element from an array.

  • concat: Joins strings into one.

  • replace: Finds and replaces characters in a string.

  • Office365Users.GetUserProfile: Fetches user properties from Azure AD, such as givenName, surname, mail, and more.

Conclusion

By extracting first and last names in this way, your Power Automate flows become more professional, reliable, and adaptable to complex naming conventions. Whether you choose the quick split method or the robust Azure AD lookup, you’ll end up with clean, properly spaced names that enhance your communications.

Hope you enjoyed this post, If you have any questions, please let me know in the comment section. Cheers!

Related Posts

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top