Can anyone try getting the username and email of all the users in a Array of the People picker control in SharePoint 2010?
If so can you provide me a Method this?
The method should have parameters like (sharepointgroupname,sharepoint user)
I have tried Like This. But it returns only one user name and email address from people picker control. I want to retrieve for multiple users Sharepoint group and Active Directory group. Please help me.
private void GetNameAndEmailFromPeoplePicker(SPListItem mySourceListItem, out String PeoplePicker, out String CCPeoplePicker, out String UserName)
{
PeoplePicker = "";
CCPeoplePicker = "";
UserName = "";
try
{
SPFieldUserValueCollection Users = new SPFieldUserValueCollection(mySiteWeb, Convert.ToString(mySourceListItem["Point of Contact"]));
foreach (SPFieldUserValue User in Users)
{
UserName = User.User.Name;
PeoplePicker = User.User.Email;
}
SPFieldUserValueCollection BCCUsers = new SPFieldUserValueCollection(mySiteWeb, Convert.ToString(mySourceListItem["Backup Point of Contact"]));
foreach (SPFieldUserValue BCCUser in BCCUsers)
{
CCPeoplePicker = BCCUser.User.Email;
}
}
catch (Exception ex)
{
UlsLogs.LogErrorInULS(ex.InnerException.ToString(), TraceSeverity.High);
}
}