Pages

Wednesday, March 24, 2010

SharePoint 2010: Share Content Type with Managed Metadata Service

Till SharePoint 2007 there’s no way to manage Content type centrally. To share Content Type across site collection level or web application level in SharePoint 2007, you need to copy the same content type in different site collections or web applications. Another way could be to use web feature to enable content type across site collections or web applications.But the good news is that SharePoint 2010 has provided out of the box support for sharing Content types across farm level.

Publish Content Type

The Enterprise Metadata Management Service or Metadata Service (in short), allows to share Metadata and Content Type across the farm. To share Content types you need to define the content type(s) in a site collection (say CTSiteCollection). You can consider the site collection (CTSiteCollection) as the place where you’ll put all your related content types to share across farm. This site collection,which is used to host content types or sharing,is called Content Type Hub.

1. Create a new content type in a site collection that you want to share

First select a site collection as a place to host your content types. You will define your content types to share across, in this site collection. You can create a new site collection or use an existing one. Once you have an site collection in your hand, create a content type and for this discussion let’s name it MyContentType.

2. Activate feature to enable content publishing in site collection:

The site collection, which will host content types for sharing, is known as content type hub. To enable your site collection to be a content type hub you need to  activate a feature known as “Content Type Syndication Hub”. Once you have activated this feature, you will find an option “Manage Publishing for this content type” in your content type setting page as shown below:

image

Figure 1: Content type publishing option will be available on activating feature “Manage Publishing for this content type”

3. Bind content type hub with a metadata service.

Go to the central administration => Application Management. Then select your metadata service or create a new one. You will find there are two entries for each metadata service. One is service and another is connection as shown below.

image

Figure 2: Metadata service and connection

Configure Metadata Service: Now click on the metadata service (but not on the name as this will bring you to ‘Term Store Management Tool’) and then click Properties button from the ribbon on the top of the page. On the properties window there’s an option for Content Type Hub and here put the url of your site collection you have selected/created (for example, http://server:port/ or http://server:port/sites/mysite). Now your metadata service is ready to be used by metadata service

Configure Metadata Connection: To configure metadata connection, go to metadata service connection properties and ensure that the connection consumes the content type hub as shown below:

image

Figure 3: Metadata connection settings for consuming content type hub.

4. Publish the content type

Now you go back to the site collection (which is used as content type hub) and go to content type settings page. Here in this page you will get the option “Manage publishing for this content type” option. If you don’t get the option activate feature “Content Type Syndication Hub” as described in step 2. Now click on the link “Manage Publishing for this content type” and ensure the ‘publish’ option is selected and then click OK as shown below.

image

Figure 4: Content type publishing page

Now you are done but you may not find the content type available immediately as the publishing is managed by a timer job which usually run in every 15 minutes. To run the job immediately you can navigate to Central Admin site => Monitoring => Review Job definitions. Then you can run the ‘Content Type Hub’ immediately.

 

Use Published Content Type

1. Associate Metadata connection to your web application:

To use published content type from a different web application or site collection, you need to associate the metadata connection with the web application. To do so navigate to the Central Administration => Application Management => Configure service application associations. Then click on the site link and you’ll be provided an “Configure Service Application Associations” window. From there ensure you have selected the metadata service which you configured for content type.

After associating the metadata service with web application, you may not get the content type immediately as a timer job will sync the content type between content type hubs and consumers. To run the job immediately navigate to Central Admin site => Monitoring => Review Job definitions. Then find the job “Content Type Subscriber”. There are one job for each subscriber. Find the job for your site and run immediately.

2. Use Content Type

To use content type go to the site where you want to use the content type. But before that make sure you have associated the metadata connection for this web application as described in step 1. Now create a new list in the consumed web site and go to list settings. Then click ‘Advanced settings’ and select yes for ‘Allow Management of Content Types’. Now click ok and move back to settings page and you should get the ‘Content Types’ option as shown below:

image

Figure 5: Content Type settings for list/library

Now you can click on ‘Add from existing site Content Types’ and you should get the consumed content type ‘MyContentType’ as we created at step 1 under section ‘Publish Content Type’. If you don’t find the content type defined in content type hub site, there’s something wrong. To troubleshoot the problem move to the next section.

 

Troubleshoot, if Content type is not available in the consumed web site

To find if there’s any problem in publishing content type, go to site where you have defined the content type. Then go to site settings => “Content type Publishing“. Here you will find options for viewing error log. Though the error log is not so much user friendly but you may get the gist of problem.

If there’s nothing in the error log then make sure the timer job (which actually causes the content types to publish/consume) is run. Timer jobs run periodically, may be after 15 minutes. To run the job immediately, go to Central Administration => Monitoring => Review Job Definitions. Find all jobs related to Content types. After running all jobs check if content type is available. If not available then search for error in the error log as described in previous paragraph.

8 comments:

  1. Thanks Sohel. Very effective and useful post. I followed the steps and worked fine. Few questions: if any change is made in the source content type (e.g adding a new column) does it require to go through the all steps described in case of a new content type to get the effect any subscribers site? Also does it work in case of an existing list in the subscribers site?

    Aniruddha

    ReplyDelete
  2. If you make any changes to source content types, all you need to do is to republish the content types again.

    ReplyDelete
  3. A great article, but I wonder if the content type that is published is read-only?
    I have a situation in which I must replicate structures of lists in different site collections and keep them up-to-date, each list can have independent data.
    The use of the content type, is that I need, there is some other alternative?

    Thanks, Rafael

    ReplyDelete
  4. Hi,
    As per MSDN document the content type is not readonly in webapplication. Rather you need to grant read/write permission to the user for the metadata service, whose credential is used in application pool of the web application. More information can be found here: http://technet.microsoft.com/en-us/library/ff625176.aspx

    ReplyDelete
  5. Thanks Sohel
    I too have written blog detailing about how to use content type syndication for multilinguaal metadata...please check this

    ReplyDelete
  6. Thanks for the detailed step.. Great !

    Can you please explain, how to publish "lookup" column type metadata filed using publish method ?

    I can see all metadata except lookup column type is able to publish.

    ReplyDelete
  7. Great information on this site thanks for sharing!
    Take Care
    Online Internet Business

    ReplyDelete

Note: Only a member of this blog may post a comment.