0

I have a SharePoint list where I use a field Person or Group to enter an Employee's name.

The second column is their email address which I enter manually. Is it possible to fill this field automatically with their email address and how?

2 Answers 2

4

Solution 1:

You can create a workflow or Microsoft flow/power automate to update the Email address field based on the Person or Group field.

Solution 2:

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.

  1. Create one single line of text column.
  2. Hide it from list forms (make it Hidden from content type settings).
  3. 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:

enter image description here

6
  • Solution 2 was a really clever approach! Just wondering why you are hiding the column? Mar 31, 2020 at 11:58
  • If you don't want to enter it manually fro list form then you probably wants to hide it from list forms. if you are okay with field being visible on forms then keep it that way. Mar 31, 2020 at 12:16
  • 1
    Also, keep in mind that by using 2nd approach we are just showing the email in list view. not actually saving the values in list column (email column). Mar 31, 2020 at 12:17
  • 1
    Ah yes of course, I should have read it again. I though you were hiding it from the list view... Mar 31, 2020 at 12:28
  • 1
    Nice solution, but will not work when user exports data to Excel, which might me one of the use cases. Try to use Flow or PowerBI instead.
    – luccio
    May 6, 2021 at 11:41
1

In addition to Ganesh Sanap’s Solution 1, here’s a sample flow for your reference.

enter image description here

There is one dynamic content called PersonGroupCol Email, which you can directly use to update the Email column. (Where PersonGroupCol is internal name of person or group field.)

Not as good as the Solution 2 but it is doable.

2
  • Thanks, i tried solution 1 with the flow and it works! I will try solution 2 also, just for practice. I also tried the trigger, When a item is selected. However, that does not work. I have over a 100 items that need to be updated with the emailadresses. So, is there a way around making an manual change to all the items first?
    – Mirte
    Apr 1, 2020 at 17:26
  • @Mirte Solution 2 is the better one actually since it updates the column in time – as soon as you fill in/modify the person or group column. If you want to bulk update item properties, you may consider using PowerShell: sharepointdiary.com/2015/07/… Apr 2, 2020 at 5:30

Not the answer you're looking for? Browse other questions tagged or ask your own question.