Metadata in Lists
Lists and content types marry together
nicely—if a content type describes some data, and lists contain
instances of data, then the content type effectively describes the
schema of a list. For example, if a list is to contain contact
addresses, you could imagine the list having columns for the person’s
name, street address, city, state, ZIP, etc. If you create a content
type, which includes these aforementioned columns, your content type
defines the schema for hosting contact information in the list.
By default, new custom lists do not maintain
columns with content types. You simply create a new list instance and
begin adding columns to the list. In this case, SharePoint implies a
local list content type from the list definition. Changing a list to
allow the management of content types provides for greater control of
content in the list—for one, a list may associate with multiple content
types, and thus have list items with different columns. This is a very
powerful concept, which separates SharePoint lists from tables found in
relational databases (which limit rows to a single set schema). Using
the previous example, picture the ability to add different
classifications of contacts to the list, some US contacts and some
European, where the US addresses contain City, State, and ZIP, and the
European addresses contain City, Province, and Postcode.
The following steps demonstrate adding content types to a document library or list:
- Navigate to a list or document library.
- From the ribbon, click the Library tab, or List tab if a list.
- From the ribbon, click the Library Settings (or List Settings) icon.
- Under General Settings on the Settings page, click the Advanced Settings link.
- Toggle the option to Allow Management of Content Types to Yes.
- Scroll to the bottom of the page and click the OK button.
- The List/Library Settings page should now show a Content Types section, as shown in Figure 6.
In my example (using a document library), you
see that my document library has one content type—Document—and this
content type is the default for all new items added to the list.
Farther down the page (not shown in the figure), in the Columns
section, is the Title column, sourced from the Document content type.
SharePoint adds the special Modified By, Create By, and Checked Out
columns to each list, which are not associated with any content type.
Add an additional content type to your library (assuming you are
following at home using a document library; the steps work similarly
for lists).
- From the List/Library Settings page, click the Add from Existing Site Content Types link.
- In the Content Type Section page, change the drop-down to display Document Content Types group.
- Select the content type Picture, and click the Add button.
- Click the OK button.
- In the Library Settings page, within the Content Types section, you should see the addition of a Picture content type.
- Scroll to the Columns section and notice the presence of new columns, as used in the Picture content type.
- Navigate back to the default view of the Shared Documents library (hint: you can use the breadcrumb at the top of the page).
- Click the Files tab on the ribbon.
- From the ribbon, click the New Document (lower part of the icon), as shown in Figure 7.
You may apply the preceding series of steps to
regular lists so that content owners and contributors may add list
items to a list with different column data. This practice greatly comes
into play when creating multiple content types for different publishing
pages within a single Pages document library of a publishing site.
One area of confusion I have seen with lists and content types is in the inheritance
chain. When adding a content type to a list, SharePoint makes a new
content type at the list level, which inherits from the site content
type of the same name. The purpose of this action is to provide a
degree of abstraction from changes applied to content types at the site
level that differ from specific changes at the list level.
Note List-level
content types inherit from site-level content types. This provides a
level of abstraction, and provides data integrity at the list level if
you delete columns from the site content type.
The following series of steps demonstrates this thinking:
- Navigate to your Library Settings page.
- Scroll to the Content Types section.
- Click the Document content type.
SharePoint shows the Content Type Settings page
for the Document content type. At the top of the page, notice that the
parent of this selected content type is Document also. The heading at
the top of the page shows as List Content Type Information.
- Click the parent Document content type.
- SharePoint now shows a page for the site-level Document content type.
- The page heading changes to show Site Content Type Information.
- Click Add from New Site Column to navigate to the new column page.
- Scroll to the bottom of the page and notice the setting for Update All Content Types Inheriting from This Type.
- Toggle this option to Yes.
- Navigate back to the List page and notice that the list-level
content type has this column because you propagated the change down.
- Repeat the steps to add a new column but toggle the option to update inheriting content types to No.
- Navigate back to the List page and notice that the column is absent.