任何人都可以尝试在 SharePoint 2010 中的人员选取器控件数组中获取所有用户的用户名和电子邮件吗?
如果是这样,你能给我一个方法吗?
该方法应具有(sharepointgroupname,sharepoint user)之类的参数
我试过这样。但它只从人员选择器控件返回一个用户名和电子邮件地址。我想为多个用户检索 Sharepoint 组和 Active Directory 组。请帮我。
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);
}
}