Showing posts with label People Picker. Show all posts
Monday, April 27, 2015
getting Multiple users in SharePoint List
Multiple users
People Picker
SharePoint 2010
SharePoint 2013
How to get multiple users from SharePoint list Pragmatically in SharePoint 2013,2010?
Posted by
Santhosh,
on
6:36 AM
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........
Subscribe to:
Posts
(
Atom
)