How to get User Email ID from Person or Group field of SharePoint List

Sagarp
Posted by Sagarp under SharePoint category on | Points: 40 | Views : 3606
using (SPSite oSite = new SPSite(SPContext.Current.Site.Url))
{
using (SPWeb oWeb = oSite.OpenWeb())
{
SPList Olist= oWeb.Lists["EmplyoeeList"];

SPListItemCollection oItems = Olist.Items;
string TOEmailAdd = string.Empty;
foreach (SPItem oListItem in oItems)
{

SPFieldUserValueCollection AssignedTo = (SPFieldUserValueCollection)oListItem["AllMgr"];

foreach (SPFieldUserValue uv in AssignedTo)
{

TOEmailAdd = TOEmailAdd +uv.User.Email + ";";

}

TOEmailAdd = TOEmailAdd .TrimEnd(';');
}
}
}

Comments or Responses

Login to post response