Monday, January 31, 2011

Using People Picker control in SharePoint programmatically

Namespace:

using Microsoft.SharePoint.WebControls;

Creating the control:

PeopleEditor editor = new PeopleEditor();
editor.AllowTypeIn = true;
editor.AutoPostBack = false;
editor.AllowEmpty = true;
editor.MultiSelect = false;
editor.ValidatorEnabled = true;
editor.EnableViewState = true;
PeoplePickerHolder.Controls.Add(editor);

Get the comma separated selected users:

string users = editor.CommaSeparatedAccounts;

No comments:

Post a Comment