Use PeopleEditor (People Picker) in SharePoint Custom App Dev
How to add the PeopleEditor (People Picker) control to your custom application development (ASPX, user controls, web parts, etc.)
The control we are interested in is the Microsoft.SharePoint.WebControls.PeopleEditor control.
First, we need to add a reference to the Namespace containing our control:
Next, add the PeopleEditor control to your page:
AllowEmpty="false"
ValidatorEnabled="true"
id="userPicker"
runat="server"
ShowCreateButtonInActiveDirectoryAccountCreationMode="true"
SelectionSet="User" />
Next, add an object on the server to work with the control:
public class MyPageName : Page
{
protected PeopleEditor userPicker;
…
}
Now, add your code needed to retrieve the entities:
{
….
PickerEntity pe = (PickerEntity)userPicker.Entities[0]; //gets first user in list
string username = pe.Description;
…
}
Notes:
The Description property will return the full account name (e.g. domain\username)
The DisplayText property will return the resolved name in the editor control (e.g. First Last)
----------------- Have A Nice Time !!! --------------------