|
Return to Newsletter Contents...
SharePoint Content Types
by: Michael Mullin, Consultant, MCAD, CRCP, MCTS
Content types were one of
the major enhancements that accompanied the release of Windows SharePoint
Services 3.0. Unfortunately, it is a concept that many users have trouble
grasping. Furthermore, it usually isn’t explained very well and some of the
explanations seem designed to increase confusion rather than enlightenment.
Assume we wish to create a
site for tracking books in a library. This site might have a list detailing each
book which the library owns. It might also have a list of books which have been
lent out, and a list of books which are past due. We might also have a list of
books which we wish to buy. The common thread in all these lists is books.
There is certain
information about a book which we will always want to track: title, author,
publisher, edition, ISBN numbers (both types), illustrator, publication date.
Each of these items will be recorded in a column of the list. Since we have
several lists dealing with books, this will require a lot of repetitive work. It
would be much easier to define the item once, and then assign that definition to
each list. This can be done with a content type.
The first step is to create
a custom site column for each item of information which we wish to store. We
then create a new content type and add those columns to it. This would be our
Books content type. We assign the Books content type to each list we create and
all those columns are immediately available.
Besides being easier to set
up, the Books content type makes maintenance tasks easier. Suppose it is decided
that we want to track the birth date of the author. Without a content type, we
would be required to go to each list and edit its list of columns, with a
content type, we add the new column to the content type and the column is
immediately available in all the lists.
But a content type is more
than a named collection of site columns. A workflow can be attached to a content
type. So can a customized document information panel and information management
policy settings. While our discussion has centered on list items, content types
can be created for documents too. When creating a document content type a
document template can be assigned to it.
While the Books content
type certainly is a convenient way to add columns, the astute reader may see a
problem here. It is probable that each list will have some unique columns. For
example, in the list of books lent out we would want to know to whom we lent the
book, so it would need a column for the borrowers name. If we add that column to
the Books content type, it would be included in all the lists using the content
type which would not be appropriate.
You may think that the
solution is simply to add the columns to the list’s columns collection. However,
a content type exists independently of the list’s columns. When you edit the
properties of a content type, only those columns explicitly assigned to the
content type are available to edit, the columns of the list to which the content
type is assigned are not available. This is true even if the list column has
been marked as required.
This brings us to the
concept of inheritance. Microsoft created two basic content types for
SharePoint: List Item and Document. Every other content type must be derived
from one of those two content types. Since our Books content type is for a list
item, it would be derived from the List Item content type. When a content type
is derived from another content type it inherits the properties of the parent
content type. Thus any columns or
workflows which belong to the parent also belong to the derived content type. If
the parent content type is altered, by adding a workflow or deleting a column,
that change would be propagated to all content types derived from it.
When you create a new
content type, you select which existing content type to derive the new content
type from. In our example, we would create a new content type, Books Lent, which
would be derived from Books. We would add a column for the borrower’s name, due
date and email address. We could then add a workflow which would send the
borrower an email to remind them to return the book on time. This way we have
unique columns in the Book’s Lent list while still maintaining the advantages of
using a content type.
Go to Top |
Return to Newsletter Contents
|