I found this blog on how to do it.
Here is the basic idea..
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
using System.Drawing;
public partial class _Default : System.Web.UI.Page
{
private PeopleEditor objEditor;
protected void Page_Load(object sender, EventArgs e)
{
objEditor = new PeopleEditor();
objEditor.AutoPostBack = true;
objEditor.PlaceButtonsUnderEntityEditor = true;
objEditor.ID = "pplEditor";
objEditor.AllowEmpty = false;
objEditor.SelectionSet = "User,SecGroup,SPGroup";
objEditor.MultiSelect = false;
Panel1.Controls.Add(objEditor);
}
private string GetAccountName()
{
string strAccountName = String.Empty;
for (int i = 0; i < objEditor.ResolvedEntities.Count; i++)
{
PickerEntity objEntity = (PickerEntity)objEditor.ResolvedEntities[i];
SPUserInfo objInfo = new SPUserInfo();
objInfo.LoginName = objEntity.Key;
strAccountName = objInfo.LoginName;
// to return a sharepoint people group formatted string use...
// strAccountName = objEntity.EntityData["SPUserID"].ToString() + ";#" + objEntity.DisplayText.ToString();
}
return strAccountName;
}
protected void Button1_Click(object sender, EventArgs e)
{
string strAccountName = GetAccountName();
Label1.Text = "account name: " + strAccountName;
}
}
Or via HTML:
<SharePoint:PeopleEditor runat="server" ID="pplEditor"
AutoPostBack="true" AllowEmpty="false" SelectionSet="User,SecGroup,SPGroup"
BorderWidth="1" Width="200px" PlaceButtonsUnderEntityEditor="false" Rows="1" />
For this code to work you must publish it to a SharePoint website. You cannot run it from the Visual Studio debugger.
Here is the MSDN class reference.