Click to Rate and Give Feedback
MSDN
MSDN Library
Web Development
SharePoint 2010
SDK Documentation
Columns
 How to: Add a Column to a List
Community Content
In this section
Statistics Annotations (0)
Collapse All/Expand All Collapse All
This page is specific to
The 2010 product release

Other versions are also available for the following:
How to: Add a Column to a List

Published: May 2010

You can specify columns in a list definition, so that each time a user provisions a list of that type, SharePoint Foundation includes the column on the list by default. List definitions can be included in Features. For more information, see Using Features in SharePoint Foundation.

After a user provisions a list, you can add columns to that list through the SharePoint Foundation 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

  1. In the list definition XML, add a Field element to the Fields element.

  2. 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, SharePoint Foundation never writes those changes back to the XML column definition itself. Instead, SharePoint Foundation stores updates made to columns as entries within the SharePoint Foundation database. For more information, see Updating Site Columns.

You can use the SharePoint Foundation object model to programmatically add columns to provisioned lists.

To add a column to a provisioned list

Date

Description

Reason

May 2010

Initial publication

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2012 Microsoft. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker