Share via


Introduction to Columns

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 add columns to sites and lists, and reference them in content types. A column represents an attribute, or piece of metadata, that the user wants to manage for the items in the list or content type to which they added the column.

A site column is a reusable column definition, or template, that you can assign to multiple lists across multiple SharePoint sites. Site columns decrease re-work and help you ensure consistency of metadata across sites and lists. For example, suppose you define a site column named Customer. Users can add that column to their lists, and reference it in their content types. This ensures that the column has the same attributes, at least to start with, wherever it appears. Much like site content types, you define a site column at the site level, independent of any actual list or content type.

When you add a column to a list, Windows SharePoint Services copies the site column locally onto the list as a list column. You can then make changes to the list column; these changes apply only to the column as it behaves on that list.

You can also create your own list columns, directly on a list. Either way, list columns apply only to the list to which you add them; they cannot be added to multiple lists.

You can reference a site or list column in a content type.

Note

In the Windows SharePoint Services object model, and Collaborative Application Markup Language (CAML), columns are most often referred to as fields.

Column Properties

You can specify the following properties for a column:

  • Name   The column name must be unique among all column groups at the scope at which you create it.

  • Data type   You can choose any of the data types Windows SharePoint Services supports; for example, single or multiple lines of text, number, currency, date and time, or calculation.

    Note

    If you select a lookup data type, the site column behaves as though you are creating it on a list in the current site. You can select any list in the site. If you select a calculated data type, Windows SharePoint Services performs no validation on the column formula when you create it. When you add the column to a list, either directly or by adding a content type that contains the column, Windows SharePoint Services validates the column as though you were creating the column on the list for the first time.

  • Detailed optional settings   You can select any other optional settings to apply for the data type you selected.

  • Column group to which this column belongs   Column groups are user-defined groups that help you organize your columns into logical categories.

Column Scope

Site columns also behave like site content types in terms of scope. When you create a site column on a site, that site column also becomes available to any child sites, and thereby, the lists on those sites.

For more information, see Content Type Scope.

Also like content types, site columns are available to all the child sites of the site on which they are defined.

At the site level, the site column collection contains definitions for each site column defined on the site, whether or not it has been added to a content type or list on that site.

Adding Site Columns to Lists

You can add a site columns to a list. When you do, Windows SharePoint Services copies the site column locally onto the list as a list column. You can then make changes to any of the list column properties you choose. However, when you add a site column to a content type, Windows SharePoint Services includes only a reference to that site column in the content type, not the entire column definition. Because of this, in content types you can change only a subset of the column properties, such as the column display name, XML promotion and demotion attributes, and whether the field is optional, required, or hidden.

For more information, see Fields and Field References.

You can also add columns you create directly to lists, as in Windows SharePoint Services 2.0. You can create site columns and later add those to a site content type or list. You can also create columns on a list and add those columns to the list content types on that list.

Note

To create or manage a site column on a site, you must have Web Designer access rights to that site. Specifically, you must have Manage Lists and Add and Customize Pages access rights on the site where the column resides. To add a column to a list, you must have List Administrator rights to that list.

Referencing Columns in Content Types

You can reference site and list columns in content types. When you reference a column in a content type, Windows SharePoint Services adds a reference to the column to the content type. This reference includes the column ID. When you add a content type to a list, the columns referenced in that content type are added to the list as list columns, if have not already been added.

You can reference site columns in a site content type. The site column must be in scope for the content type. That is, the site column must be defined on the same site, or on a parent site of the site content type.

For a list content type, you can reference site columns, as well as any list columns defined on the same list.

In the column reference in a content type, you can override a subset of the column properties, such as the following:

  • Display name

  • XML promotion and demotion attributes

  • Whether the field is optional, required, or hidden

Changing these properties in the column reference changes them only as they apply to the specific content type that contains the column reference.

Creating Columns

You can create columns in three ways:

  • By using the Windows SharePoint Services user interface

  • By using the Windows SharePoint Services object model

  • By deploying a Feature that installs the column based on an XML definition file

    For more information, see Working with Features.

In each case, columns created at the site level are site columns, while those created at the list level are list columns.

Deleting Columns

If a site collection contains lists that contain a site column you want to delete, you cannot delete that site column.

If you delete a column from a list, that column is also deleted from any list content type on that list.

When you delete a column, all data associated with that column is also deleted.

See Also

Concepts

Adding Columns in Content Types to Lists

Updating Site Columns

Introduction to Content Types

Other Resources

Column Definition Schema Overview