Forum Discussion
Display email from a person column
Hi
I would have thought this would have been quite easy but can't seem to work out how to do!
I have a SP list that has a Person column called Contact which links to our internal directory. I have another column called Email which is also a Person column that I have set to display the email address for that Person. So when entering a person I need to select the the name twice. How can I set it that when I select a name in the contact column that it displays the email in the Email column?
Many thanks for help.
Solution 1:
You can create a power automate flow on item creation/item update to update the Email address field based on the Person or Group field.
Solution 2: Customize list forms using Power apps and set default value of email address field based on the Person or Group field.
Solution 3: If you are not going to use those email address values later (you don't need to save emails in column) and you just want to show the email in SharePoint list view then you can also achieve it using JSON column formatting.
- Create one single line of text column.
- Hide it from list forms (make it Hidden from content type settings).
- Then use below JSON code to format the column:
{ "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json", "elmType": "div", "txtContent": "[$PersonGroupCol.email]" }
Where PersonGroupCol is internal name of person or group field.
Output:
Similar thread: Get Email from user and enter into SharePoint list field
Related read: How to find the Internal name of columns in SharePoint Online?
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
Solution 1:
You can create a power automate flow on item creation/item update to update the Email address field based on the Person or Group field.
Solution 2: Customize list forms using Power apps and set default value of email address field based on the Person or Group field.
Solution 3: If you are not going to use those email address values later (you don't need to save emails in column) and you just want to show the email in SharePoint list view then you can also achieve it using JSON column formatting.
- Create one single line of text column.
- Hide it from list forms (make it Hidden from content type settings).
- Then use below JSON code to format the column:
{ "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json", "elmType": "div", "txtContent": "[$PersonGroupCol.email]" }
Where PersonGroupCol is internal name of person or group field.
Output:
Similar thread: Get Email from user and enter into SharePoint list field
Related read: How to find the Internal name of columns in SharePoint Online?
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
- JamesPhImpCopper Contributor
ganeshsanap Thank you, I was hoping there was a simpler way - but I set up a flow.
- cdfjdkCopper Contributor
This works very nicely, thank you! But it is not possible to concatenate these columns. Is it possible to somehow wrap the returned email address as text to support concatenation?
cdfjdk Are you using person or group column with multiple selection allowed?
If yes, you can use join operator to concatenate email addresses. Use JSON like:
{ "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json", "elmType": "div", "txtContent": "='Emails: ' + join([$Name.email], '; ')" }
Please consider giving a Like if my post helped you in any way.
- StefudemCopper Contributorganeshsanap Thank you for this solution which works really well. I would like to know what other information can be retrieved this way? By replacing column.email. I would also like to retrieve the user's login in addition to their email address.
You can get following properties from person column using SharePoint JSON formatting. The people field object has the following properties (with example values):
{ "id": "122", "title": "Kalya Tucker", "email": "email address removed for privacy reasons", "sip": "email address removed for privacy reasons", "picture": "https://contoso.sharepoint.com/kaylat_contoso_com_MThumb.jpg?t=63576928822", "department":"Human Resources", "jobTitle":"HR Manager" }
Please consider giving a Like if my post helped you in any way.