开发者

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

开发者 https://www.devze.com 2023-01-19 10:01 出处:网络
Looking for a snippet of code开发者_如何学编程.The \"People picker\" control is used by SP when a column is of type User

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

精彩评论

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