views:

21

answers:

1

Looking for a snippet of code.

A: 

The "People picker" control is used by SP when a column is of type User

so, the following snippet will add one such column:

using (SPWeb oWebsite = SPContext.Current.Site.AllWebs["MySite"])
{
    SPFieldCollection collFields = oWebsite.Lists["MyList"].Fields;
    collFields.Add("MyField", Microsoft.SharePoint.SPFieldType.User, false);
}
Timores
Thanks. I kept missing the SPFieldTYpe.User. Duh.
Shane