How to: Add a Column to a List
This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
You can specify columns in a list definition, so that each time a user provisions a list of that type, Windows SharePoint Services includes the column on the list by default. List definitions can be included in Features. For more information, see Working with Features.
After a user provisions a list, you can add columns to that list through the Windows SharePoint Services object model.
If you want to add a column to a list definition that is part of a Feature, you must add the necessary XML element to the list definition. Then, when a user provisions a list of that type, the column is included by default on the provisioned list.
To add a column to a list definition in a Feature
In the list definition XML, add a Field element to the Fields element.
To define the field as you want, set the attributes of the Field element.
If you make changes to a column on a list that has been provisioned, Windows SharePoint Services never writes those changes back to the XML column definition itself. Instead, Windows SharePoint Services stores updates made to columns as entries within the Windows SharePoint Services database. For more information, see Updating Site Columns.
You can use the Windows SharePoint Services object model to programmatically add columns to provisioned lists.
To add a column to a provisioned list
Use one of the following methods of the returned SPFieldCollection object to add a new column to the list: