Get user Email ID from a sharepoint people picker field / column of SharePoint list

The below code works fine to get an Email ID from people picker field for an Item of a list.

        string userEmailID = GetUserEmail(spListItem, "PeoplePickerfieldName");

        public string GetUserEmail(SPListItem spListItem, string fieldName)
        {
            SPFieldUser spFieldUser = (SPFieldUser)spListItem.Fields[fieldName];
            SPFieldUserValue spFieldUserValue = (SPFieldUserValue)spFieldUser.GetFieldValue(spListItem[fieldName].ToString());
            return spFieldUserValue.User.Email;
        }


The above code from the below URL:

http://techiescode.blogspot.com/2013/10/get-user-email-id-from-sharepoint.html


Comments

Post a Comment

Popular posts from this blog

SharePoint 2016 and 2019 Ports

Unlock the SharePoint site using Powershell command

PsConfig step by step /Configuration Wizard. “Upgrade Available” vs “Upgrade required”