SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to add a attribute (Person or Group) in List through coding, does any one know how to do it.


share|improve this question
up vote 1 down vote accepted

[Saboor's comment re-posted as an answer, with minor modifications]

SPSite site = SPContext.Current.Site;
using (SPWeb web = site.OpenWeb())
  SPListCollection lists = web.Lists;
  SPList list = lists['Guid for List'];
  list.Fields.Add("people", SPFieldType.User, false);
share|improve this answer
Thanx. Remember to mark answers made on behalf of others as CW – Anders Rask Jun 7 '11 at 8:00

Itm["AssignedTo"] = new SPFieldLookupValue(Vti, "");

here vti is USserID or GroupID

share|improve this answer
Actually, I have created a list and wanted to add a column in it of people group type, not want to set values in it. – Saboor Awan Apr 4 '11 at 7:42
SPField Field = null; Field = currentWeb.Fields[FName]; List.Fields.Add(Field); – vipin Paliwal Apr 4 '11 at 8:34

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.