开发者

How to add a People Picker SPField to a SPList in SharePoint?

Looking for a snippet of code开发者_如何学编程.


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);
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜