PeopleEditor Class
Represents a PeopleEditor object in a PeoplePicker control.
Namespace: Microsoft.SharePoint.WebControls
Assembly: Microsoft.SharePoint (in microsoft.sharepoint.dll)
Assembly: Microsoft.SharePoint (in microsoft.sharepoint.dll)
[ValidationPropertyAttribute("CommaSeparatedAccounts")] [SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel=true)] [AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level=AspNetHostingPermissionLevel.Minimal)] [SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel=true)] [AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)] public class PeopleEditor : EntityEditorWithPicker
System.Object
System.Web.UI.Control
System.Web.UI.WebControls.WebControl
Microsoft.SharePoint.WebControls.EntityEditor
Microsoft.SharePoint.WebControls.EntityEditorWithPicker
Microsoft.SharePoint.WebControls.PeopleEditor
System.Web.UI.Control
System.Web.UI.WebControls.WebControl
Microsoft.SharePoint.WebControls.EntityEditor
Microsoft.SharePoint.WebControls.EntityEditorWithPicker
Microsoft.SharePoint.WebControls.PeopleEditor
Get e-mail address from PeopleEditor PickerEntity
To get the Email Address use
PickerEntity pckEntity = (PickerEntity)peResponsible.ResolvedEntities[0]; //where peResponsible is a PeopleEditor Control string email = pckEntity.EntityData["Email"].ToString();
Hope it helps
(pckEntity.EntityData["Email"] only in Active Directory user stores. Joe J)
- 5/22/2008
- Hernan Veiras
- 4/23/2009
- Stanley Roark
Using this control inside of an UpdatePanel issue
Using this control inside of an update panel and setting its visibility to off on first load, and then to on based on a postback event causes a javascript error. It also causes the control to no longer function.
Solution: Do not use Visible property. Instead use style="display: none" and on postback set to "display: block";
- 6/20/2008
- Keivan Sadralodabai
- 8/20/2008
- Glen Rohrer
Get e-mail address from PeopleEditor PickerEntity
I've got some bad news for you, sir.
'Microsoft.SharePoint.WebControls.PeopleEditor.PeopleInfo' is inaccessible due to its protection level.
...and, enumerating the key-value pairs in the EntityData hashtable:
DisplayName = WIN2K3\administrator
SPUserID = 1
PrincipalType = User
Any other ideas on how to recover the e-mail address from a PickerEntity?
'Microsoft.SharePoint.WebControls.PeopleEditor.PeopleInfo' is inaccessible due to its protection level.
...and, enumerating the key-value pairs in the EntityData hashtable:
DisplayName = WIN2K3\administrator
SPUserID = 1
PrincipalType = User
Any other ideas on how to recover the e-mail address from a PickerEntity?
- 4/22/2008
- Joe Zamora
- 4/22/2008
- Joe Zamora
Where to look for usage of PeopleEditor
best example is in _layouts/aclinv.aspx
- this page uses a PeopleEditor control called userPicker
to have a look at the codebehind:
-> open "Microsoft.SharePoint.ApplicationPages.dll" in Lutz Roeder's .NET Reflector
-> Go to "Microsoft.SharePoint.ApplicationPages.AclInv"
-> Check out "public void BtnOK_Click(object sender, EventArgs e);"
this event adds users chosen in the PeopleEditor to a group or direclty grants them permissions.
What it does is:
-> Iterate through this.userPicker.ResolvedEntities, map to an array of SPUserInfo[];
-> Like so:
PickerEntity entity2 = (PickerEntity) this.userPicker.ResolvedEntities[index];
SPUserInfo info = new SPUserInfo();
info.LoginName = entity2.Key;
info.Email = (string) entity2.EntityData[PeopleEditor.PeopleInfo.Email];
info.Name = entity2.DisplayText;
info.Notes = string.Empty;
addUsersInfo[index] = info;
-> then add that to a group like so: this.ReferencedGroups.GetByID(int.Parse(this.DdlGroup.SelectedValue)).Users.AddCollection(addUsersInfo);
- this page uses a PeopleEditor control called userPicker
to have a look at the codebehind:
-> open "Microsoft.SharePoint.ApplicationPages.dll" in Lutz Roeder's .NET Reflector
-> Go to "Microsoft.SharePoint.ApplicationPages.AclInv"
-> Check out "public void BtnOK_Click(object sender, EventArgs e);"
this event adds users chosen in the PeopleEditor to a group or direclty grants them permissions.
What it does is:
-> Iterate through this.userPicker.ResolvedEntities, map to an array of SPUserInfo[];
-> Like so:
PickerEntity entity2 = (PickerEntity) this.userPicker.ResolvedEntities[index];
SPUserInfo info = new SPUserInfo();
info.LoginName = entity2.Key;
info.Email = (string) entity2.EntityData[PeopleEditor.PeopleInfo.Email];
info.Name = entity2.DisplayText;
info.Notes = string.Empty;
addUsersInfo[index] = info;
-> then add that to a group like so: this.ReferencedGroups.GetByID(int.Parse(this.DdlGroup.SelectedValue)).Users.AddCollection(addUsersInfo);
- 3/1/2007
- Thomas Prentis
- 3/6/2007
- RogerLin