How to add ListItem to List, "Person or Group" column
SPWeb website = SPControl.GetContextWeb(Context);
SPList oList = website.GetList("/Lists/Team%20Members");
SPListItem item = oList.Items.Add();
SPUser user;
website.AllowUnsafeUpdates = true;
user = website.SiteUsers["MOSSDEV1\\abc"];
item["Member"] = user;
item.Update();
website.AllowUnsafeUpdates = false;
SPList oList = website.GetList("/Lists/Team%20Members");
SPListItem item = oList.Items.Add();
SPUser user;
website.AllowUnsafeUpdates = true;
user = website.SiteUsers["MOSSDEV1\\abc"];
item["Member"] = user;
item.Update();
website.AllowUnsafeUpdates = false;
Comments
Post a Comment