How to get value from people picker control in infopath in SharePoint?

In this post, we will discuss how to get value from people picker control in InfoPath in SharePoint 2010 using SharePoint 2010 object model.

Also, you can check out my previous posts on:

-What is the role of ScriptManager in Ajax?

– Set the Bing Maps key at the web and farm level in SharePoint 2013

Deploy custom images in SharePoint 2010

Below is the code to get the value from people picker control in InfoPath 2010.

XPathNavigator domNav = MainDataSource.CreateNavigator();

XPathNavigator XPNEAMName = domNav.SelectSingleNode(“/my:myFields/my:EnjoySharePoint/pc:Person/pc:AccountId”, NamespaceManager);

string accountid = XPNEAMName.Value;

Here the account id will return as “DomainName/UserName”.

Once we will get the account id then we can retrieve the name or email id like below:

using (SPSite thisSite = new SPSite(ServerInfo.SharePointListUrl.ToString()))

using (SPWeb web = thisSite.OpenWeb())

user = web.EnsureUser(AccountId);

string email = user.Email;

string name = user.Name;



free sharepoint training

SharePoint Online FREE Training

JOIN a FREE SharePoint Video Course (3 Part Video Series)


Bijay Kumar

I am Bijay from Odisha, India. Currently working in my own venture TSInfo Technologies in Bangalore, India. I am Microsoft Office Servers and Services (SharePoint) MVP (5 times). I works in SharePoint 2016/2013/2010, SharePoint Online Office 365 etc. Check out My MVP Profile.. I also run popular SharePoint web site