How to: Add a Column to a Site
You can specify columns in a site definition so that each time a user provisions a site of that type, Windows SharePoint Services includes the column as an available site column. Site definitions can also be included in Features. For more information, see Working with Features.
After a user has provisioned a site, you can add site columns to that site through the Windows SharePoint Services object model.
Specifying a Site Column in a Site Definition
To add a site column to a site definition that is part of a Feature, you must add the necessary XML element to the site definition. Then, when a user provisions a site of that type, the column is included by default in the site column collection.
To specify a site column in a site definition in a Feature
Create the field as a separate Feature.
Reference that Feature in the Feature that defines your site:
In your site Feature, open the XML file that defines your site.
In the Project element, under the Categories and Category elements, add a reference to the content type Feature in either the SiteFeatures or WebFeatures element. Following is an example.
[xml] <SiteFeatures> <Feature ID="00BFEA71-1C5E-4A24-B310-BA51C3EB7A57" /> <Feature ID="695B6570-ACDC-4A8E-8545-26EA7FC1D162" /> </SiteFeatures> <WebFeatures> <Feature ID="00BFEA71-4EA5-48D4-A4AD-7EA5C011ABE5" /> <Feature ID="00BFEA71-E717-4E80-DEAF-D0C71B360101" /> </WebFeatures>
If you make changes to a column that is 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.
Adding a Column to a Provisioned Site
You can use the Windows SharePoint Services object model to programmatically add columns to provisioned sites.
To add a column to a provisioned site
To add a new column to the site, use one of the following methods of the returned SPFieldCollection object: