Online Training On SharePoint

Thursday, 17 April 2008

Introduction to Content Type in MOSS

Content Type Definition: A content type is a reusable collection of settings we want to apply to a certain category of content. Content types enable us to manage the metadata and behaviors of a document or item type in a centralized, reusable way.

Problem that can be solved with Content Type: Suppose we want to store two entirely different kind of documents such as software specifications and legal contracts in the same document library. The metadata we would want to gather and store about each of these document types is also very different. In addition, we want to assign very different workflows to the two types of documents.

Solution with the content Type: Content types enable us to store multiple different types of content in the same document library or list. In the preceding problem statement, we could define two content types, named Specification and Contract. Each content type would include different columns for gathering and storing item metadata, as well as different workflows assigned to them. Yet items of both content types could be stored in the same document library.

Content Type Settings:
We can further extend content type functionality by using them to assign additional settings, such as workflows, or even custom attributes, to items.
A content type can include the following information:
· The metadata, or properties, you want to assign to this type. These are represented by columns added to the list or document library when you add the content type. Only site columns can be added to a content Type.
· Custom New, Edit, and Display forms to use with this content type.
· Workflows available for items of this content type. These can be defined to start automatically based on a selected event or condition, or through user selection.
· For document content types, the document template on which to base documents of this type.
· Any information necessary for custom solutions associated with this content type. We can store this information in the content type as one or more XML documents.

Content Type Creation:
We can create column and content types in three ways:
· Using the Windows SharePoint Services user interface
· Using the Windows SharePoint Services object model
· Deploying a Feature that installs the content type based on an XML definition file.

Here we need to be careful while selecting the above described methods to deploy the Content Type. Basically when a new content type is created and added to the root site’s gallery, it is made available to be added to any list. Then when that content type is added to the list, the content type is copied to the list and given a new id and a reference to the root site’s content type.
When changes are made to a content type through the SharePoint user interface by adding a column, the user has the option to “Update all content types inheriting from this type”. Selecting yes causes the page to call the SPContentType.Update method to push the changes to every instance of the content type within the site collection.
However, when changes are made to the content type using SharePoint feature infrastructure, the changes are only made to the content type definition, not to all the “children” of that content type.

See the Hierarchy of Content Types in SharePoint here:

You may be interested to see
Hiding/Displaying Content Type with SharePoint Object Model

Attempt Questions on Content Type:
Question on Content Type Creation

Question on Columns in Content Type
Post a Comment
Related Posts with Thumbnails