Here we will also discuss how to retrieve the display name, email id and login name from a person or group list field in SharePoint Online or SharePoint 2013/2016 using jsom SharePoint.
What is People Picker in SharePoint Site?
In the SharePoint Site, People picker control is used for selecting the valid User account of a person or a Group those who are present in the Organization.
Retrieve display name and email from a person or group list field in SharePoint
Now, we will see how we can retrieve the display name, email id and login name from the person or group list field in SharePoint Online or SharePoint 2013/2016.
Retrieve the People Picker value in SharePoint Site
Here in this SharePoint Site, I will discuss how to retrieve the people picker control value by using JSOM. You can follow the below steps.
First of all, I have created a SharePoint List named “Latest Blog”. In that List, I have added a column named “Created By” which is especially a People Picker column like below screenshot.
Here in this below screenshot, It is the fully JSOM Code which is used for retrieving the People picker value or column(Created By) from the specific list(“LatestBlog”).
So here first of all, By using the “retrieveLatestBlogs” function, I have retrieved the “List Title”. Then by using the “camlQuery”, I have retrieved the specific item whatever I want from that list.
After that, Within the success method[success()], I have used “While” loop and there I have created a variable named as “mytable”. After that I have retrieved the People Picker column from the List as “Author”(Internal name of Created By column), then I used lookup value function.
The JSOM code for retrieving the people picker column is given below-
<p class=\'BlogCreated\'>By:" + oListItem.get_item('Author').get_lookupValue() + "</p>";
Here in this code, I have taken a class as “BlogCreated” which is used for CSS style sheet. Then I have retrieved the People Picker Control value by using .get_lookupValue().
Read some SharePoint JSOM tutorials below:
- Display List items in HTML Table using JSOM in SharePoint Hosted App
- Retrieve SharePoint list items programmatically using jsom, rest api and csom
- Retrieve all users from all groups using jsom in SharePoint
- How to retrieve SharePoint list items and display in hyperlink using jsom
- Uncaught TypeError Cannot read property get_lookupValue of null SharePoint Online JSOM
We saw how we can retrieve display Name and email from a person or group list field in SharePoint.
Hello Everyone!! I am Bhawana a SharePoint MVP and having about 10+ years of SharePoint experience as well as in .Net technologies. I have worked in all the versions of SharePoint from wss to Office 365. I have good exposure in Customization and Migration using Nintex, Metalogix tools. Now exploring more in SharePoint 2016 🙂 Hope here I can contribute and share my knowledge to the fullest. As I believe “There is no wealth like knowledge and no poverty like ignorance”