0

Normally I create a New List if I want to add an additional column to a List that already exists in a web.

Wondering what would be the best option, should I create a new list with additional column or if there is any script or something I can use to add column to existing one.

I am using sharepoint 2007 and I have this list on hundred of pages.

Content Type

 <ContentTypes>
      <ContentTypeRef ID="0x0101">
        <Folder TargetName="Forms/Document" />
      </ContentTypeRef>
      <ContentTypeRef ID="0x0120" />
    </ContentTypes>

1 Answer 1

2

you can add a column to the list by doing (a number field in this example):

SPList lst = oSPWeb.Lists["List Name"];
SPFieldNumber fld= (SPFieldNumber)lst.Fields.CreateNewField(SPFieldType.Number.ToString(), "Column Name");
lst.Fields.Add(fld);
lst.Update();

However its better to create a content type, create a list and then bind the content type to the list. That way you can manage your lists and columns better than when you constantly keep creating new lists...

2
  • In list schema.xml I have got this, but I am not really sure what its being used for here, Jul 25, 2012 at 10:31
  • edited my question Jul 25, 2012 at 10:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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