Hi friends,
Thanks for visiting my blog .
In this post, i would like to describe about "Getting multiple users from SharePoint list Programatically".
Scenario :
I came across a situation where i want to fetch the usernames and email IDs from list (Column is people Picker and Check the "allow multiple users" option).
Solution :
Please find the the below code snippet
*********************************
SPFieldUser UsersColumn = (SPFieldUser)lstNewPrsReq.Fields.GetField("ColumnName");
SPFieldUserValueCollection Users = (SPFieldUserValueCollection)UsersColumn.GetFieldValue(lstitemCollection[0]["ColumnName"].ToString());
if (Users != null)
{
foreach (SPFieldUserValue user in Users)
{
SPUser spUser = user.User;
if (spUser != null)
strCCEmail = strCCEmail + ";" + spUser.Email;
}
strCCEmail = strCCEmail.TrimStart(';');
}
strCCEmail : This string contains all the mail ids of the users for that particular list item.
hope this blog helps you........