Content Types
Content types provide content owners with the
powerful capability to manage metadata content in SharePoint. The basic
anatomy of a content type is that of a group of site columns (fields)
that represents a content object in the content management system. For
example, a content type may include several site columns that
constitute a person’s contact details—name, address, telephone, and so
on.
Understanding the use of content types is
important when discussing content and metadata management in
SharePoint, because SharePoint uses content types practically
everywhere there is categorization or definition of content schema. The
following are some of the areas in which SharePoint employs the use of content types:
- Column definitions in lists and list items
- Document metadata (document properties) in document libraries
- Content fields in publishing pages
- External data definition via Business Connectivity Services
- Search filtering and scopes
Content types incorporate inheritance in the SharePoint Metadata System,
which provides for greater levels of flexibility in metadata modeling
and abstraction of content definition. Content owners may define basic
content types and then subclass these content types to define new
content types with greater refinement of metadata.
As an example, Table 1 defines a Bio-Page content type for a publishing page, containing biographic information for staff members on an organization’s public web site.
Table 1. Site Columns for a Bio-Page Content Type
First Name |
Single line of text |
First name of staff member |
Last Name |
Single line of text |
Last name of staff member |
Abstract |
Multiple lines of text |
Small blurb about the staff member |
Biographic Text |
Full HTML |
Complete bio of the staff member |
Biographic Image |
Publishing image |
Headshot image of the staff member |
When coupling this content type with a page
layout, SharePoint allows content owners to define new page instances,
with the defined site columns, to contain data about a staff member.
The page layout defines HTML markup, which tells SharePoint how to
render the page content. The actual content of the page resides in a
list item that is the page instance in a Pages document library.
The organization hosting the web site decides
one day to provide a new advanced biographic page type that not only
shows the standard details on a staff member, but also includes
education information. To achieve this new advanced Bio-Page
implementation, the site designers provide a new page layout, based on
the standard Bio-Page layout, with placeholders for the new education
fields. Rather than create a completely new content type to associate
with the page layout, SharePoint allows the content owners to subclass
the standard Bio-Page content type and add the additional fields.
Using content type inheritance, users may
create elaborate metadata models with basic content types at the root
of the model, and more specification of content types throughout the
branches of the model. Figure 3
illustrates the concept of content type inheritance. Both the MSA and
SOW content types exist as separate document content types, which
inherit from the common Contract content type
parent. The Contract content type inherits from the stock Document
content type, which itself inherits from the stock Item content type.
All the columns in each content type of the chain exist in the leaf
content type, so the SOW content type includes the following columns:
Project, Contact, Customer, Size, and File name.
SharePoint defines a basic content type, called
Item, which contains the site column Title. Examples of content types
that subclass the Item content type include Document, which adds the
Name column for the file name, and Announcement, which includes columns
for the Body of an announcement and a date field for Expiration.
SharePoint ships with many stock content types in Basic and Team site
definitions, and even more in Publishing site definitions.
As it does with site columns, SharePoint
maintains a list of content types in a site. The following steps
demonstrate how to create a new content type for our Bio-Page (Table 1):
Note Even
though SharePoint will allow you to create content types and site
columns at any subsite level in the site collection, as a general best
practice, define all content types and site columns at the root of the
site collection so you may use them throughout the entire hierarchy.
- From the root of the site collection, click the gear icon.
- Click the Site Settings menu item.
- On the Site Settings page, under Galleries, click the Site Content Types link.
SharePoint shows all the content types defined in the site collection, as in Figure 4.
There you can see that each content type belongs to a group and
specifies both a parent and the source location in the site collection
hierarchy.
Note Every content type inherits from a parent, even if it is just the base Item content type.
- Click the Create link at the top of the page.
- Give the new content type a name and a description.
- Specify the parent content type. SharePoint helps you out here by providing a drop-down to restrict the choices by group.
- Provide either an existing group or a new group name to file the new content type.
- Click the OK button.
SharePoint should now show you the Settings page (Figure 5)
for the content type created. SharePoint allows you to attach workflow
and information management policy, change general settings for the
content type in the Settings section of this page, and much more.
- Scroll to the Columns section.
- You should see those columns present from the parent content type.
In my case, I inherited from the Item content type, and so I see the
Title column only.
- SharePoint indicates the parent content type under the Source
heading (linked). You may click this link to visit the settings of the
parent content type.
- Click the Add from existing site columns link to navigate to a page
to choose from existing site columns at the current site and above (if
not at the root of the site collection).
- Click the Add from new site column link to create a new site column
for the content type—any new site column created resides in the Site
Columns Gallery of the current site.
Content types provide for powerful, yet
flexible definition of the metadata. Like most things in life, this
power and flexibility comes with caveats, as follows:
- You cannot delete a content type once it is in use by a container, list item, or page, or inherited by another content type.
- Once you create a content type, you may not change its inheritance
relationship with the parent. You must delete the content type and
re-create it to inherit from a different content type. This
restriction, coupled with the first caveat, can make for difficulty in
restructuring an existing metadata model in use by content. Design your
model with flexibility at the onset.
- Deleting an inherited column from a content type is ill advised. Instead, make the column hidden.
- Avoid modifying stock content types. Instead, create a new content
type and add customization to your new type—content owners expect
standard behavior when using stock content types.
- You may not delete any content type deployed via a custom-developed feature.
Content types not only define metadata for
documents in libraries and list items in lists, they also provide
additional functionality, outlined in Table 2.
Table 2. Functionality Associated with Content Types
Templates |
You may associate a document template with a document content type,
such as a Contract content type that associates with a Word document,
containing the skeleton of a contract document. When users create a new
list item, using the content type, SharePoint will open the template so
the user may begin editing the document. You may also specify an ASPX
page in the SharePoint site collection as the template, so SharePoint
opens a web page when a user creates a new content type. |
Document Information Panel (DIP) |
This panel appears in Office applications to show users the
metadata associated with a document they opened from SharePoint. |
Workflow |
You may associate a workflow with a content type, so when users
create a new list item based on the content type, SharePoint starts the
workflow. |
Management Policy |
Management policy applies to content types. You may audit events on
list items that use a content type, apply retention rules, and do
similar tasks. |
Of course, Table 2
is not exhaustive. Content types play a major role in SharePoint and
provide the central core for many data-associated functions. Content
types provide data portability in that each content type describes
data—the schema—such that you can use these content types anywhere you
wish to apply specific functionality to certain data types.