Content Types in SharePoint 2010

Let's start discussing content types in SharePoint 2010. Content Type Hub is a new concept in SharePoint 2010. But before going into more details, let's first discuss briefly what the content types are.

So our agenda for the discussion is:

  1. What are the Content Types
  2. Problem with Content Types in MOSS 2007
  3. Content Type Hub in SharePoint 2010
  4. How to publish content types on Content Type hub
  5. How to expose published content types for the web applications (How to subscribe the published content types)

What are the Content Types?
  1. Content Types are very important and powerful features in SharePoint.
  2. A Content type is a group of site columns (or metadata), workflows and other settings for the item in the list or document in document library or for SharePoint page.
  3. Content types are reusable component, they are not specific to any list or library or page layout.
  4. Content Type represents group of information with common properties. For example, you are maintaining the list of the employees for your company, but there are different details for the employees who are onsite. So here you can create two different content types; one for onsite employees and another for local employees. You can associate these content types with the Employee list. So whenever you enter the details for an onsite employee you will create the list item from onsite content type. Also by going one more step ahead we can create base content type with common fields (site columns) and derive two content types from base content type.

Some More Details:
  1. We can create content types in SharePoint by the following 3 ways:

    a. From UI
    b. Using CAML (Collaborative Application Markup Language)
    c. Using SharePoint Object Model (i.e. Programmatically)
  2. We can associate one content types to multiple lists and libraries
  3. SharePoint comes with several OOB content types.
  4. Content types are always inherited; content types are never created from scratch. So an existing content type is always selected as a base content type for creating a new content type. So we automatically get all the columns from the base content type for the new one.
  5. Content Types are stored in the SharePoint database. Databases are created for the web application. We can view all the content types from content type gallery (Site Action >> Site Settings >>Galleries>>Site Content Types). Content Type gallery is the document library.


    Figure. Content Type Gallery option

Problem with Content Types in MOSS
  1. Now suppose I have created a few content types for my site collection in WebApplication1. And now I want to use some of the content types created in webApplication1 for WebApplication2. But I don't have such an option to share the content types in multiple web applications. I need to copy and paste all the content types with code and separately deployment on the WebApplication2.
  2. Also then there is no synchronization mechanism between the content types. If I do some modifications in content types for web application1 then I need to do these changes also content types available for web application2.

Content Type Hub in SharePoint 2010
  1. To overcome the above problem SharePoint 2010 introduces a new concept called Content Type Hubs.
  2. Content Type Hub is the centralized place where all content types are published and the web applications which will require the content types will subscribe to the content type hub and can get the published content types from the hub.
  3. Web application which subscribes the published content types also can receive the updates on published content types.
  4. So Content Type hub is nothing but the separate common site collection where all content types will get created.
  5. Now to act as this site collection as a content type hub we need to activate the "Content Type Syndication Hub" site level feature.


    Figure. Feature activation required for Content Type hub
  6. Once we have activated this feature we will get a link to "Manage publishing for this content type" for every content type setting page as:


    Figure. Link for Manage Publishing for this content type

Exposing the Content Types published on Content Type Hub to the web applications
  1. Now to expose our content type created on the hub we need to configure Managed Metadata Service.
  2. Enterprise Metadata Management Service (Metadata Service) allows us to share the content types across the farm.
  3. Next, we need to bind the content type hub with the meta data service, for this go to
    Central Administration >> Application Management>>Manage Service Application.


    Figure. Manage service applications option
    If metadata service is already created then we will get two entries, one is the service and one is connection


    Figure. Manage Metadata Service Application and Connection Links

    Select the metadata service, click on the Meta data service and click properties button.

    On the properties window, put the URL of content type hub site collection.


    Figure. Content Type Hub URL option
    Also, click on metadata connection, click on properties button and make sure that "Consumes content types from the Content Type Gallery at <URL of your content type hub site collection>" check box is checked.


    Figure. Managed metadata connection

Publishing the Content Type
  1. Now we can publish any content type from the content type hub site collection, to be used in the other web applications for which this Meta data connection is associated.
  2. Go to the content type setting page, click on the link "Manage Publishing for this content type", and make sure that Publish option button is selected.


    Figure. Content Type Publishing options
  3. Now these publishing of content types are managed by the timer job which is executed after every 15 minutes and then available to the subscriber web application.

    a. Content Type Hub (Server Job)
    b. Content Type Subscriber (Job for the web application which is subscribing the content types)