Wednesday, March 13, 2013

Content Type Hubs – Publish and Subscribe to Content Types

MOSS 2007
Say for example you have a Site Collection Web Application1 and you have created a series of content types to use. Now, you create Web Application2 and find the necessity to reuse the content types created in Web Application 1. There is no way you could share or reference those content types created in Web Application1in Web Application2. The only way possible is to create or write an application which would install those content types. This situation is pretty common in large organizations. This can be even considered for exposing base content types you use across multiple web applications in the farm.

Below is the diagram representing the above chaos:














SharePoint 2010
SharePoint 2010 now introduces a new feature called Content Type Hubs.Content Type Hub is a central location where you can manage and publish your content types – so now web applications can subscribe to this hub and pull down the published content types from the hub. Even receive updates on the published content types
!
As you can see, the content type hub is exposed to every web application using the Metadata Service Application. So, as long as the web applications use the same Metadata Service Application, the content types will be pushed to those subscribed web applications.

Configuring The Content Type Hub
This is pretty simple.
1) Create the web application and the root site which you want it to be the Hub
2) In the Managed Metadata Service Application (under Central Administration | Application Settings | Service Applications )properties, you can set the Content Type Hub



3) In the Managed Metadata Service Connection, we explicitly tell to consume content types from the hub
4) Now, we can go to our content type hub site, create content types and you should see Manage content type publishing option

5) And publish the same



6) This will publish the content types
Timer Jobs
In order to receive the published content types immediately, you can go and run two timer jobs immediately:
1) Content Type Hub
2) Content Type Subscriber (of the web application which is going to receive the content types updates)
Published Content Types
After running the timer jobs, the content types should be published. Go to your Site Settings | Site Collection Administration | Content Type Publishing
You can see all the published content types here :)

Remember, as long as the Web Application use the same Metadata Service Application the content type hub is using, it can receive the content types from the hub.



Tip of the day


Features can be used to deploy content types in the Hub. They are always the best practice. Just be aware that this will create a dependency on them with a FeatureId, and by doing this, when you publish the content types, the same Feature on the Site Collections Subscribers will be required, so you can get the content types published.
Other option is to use a Powershell script or Console Application. In this case, when you publish the content types, there is no need to activate any feature in the Site Collections Subscribers.
I hope it clarifies the options you have when deploying and publishing content types. :)

Conclusion

In the version of SharePoint Server 2010, the Service Metadata Application enables the sharing of Content Types, which promotes the Content Type Syndication in different Site Collections from different Web Applications, and even in different Farms!
Enjoy this feature to create a new Design sharing Content Types!


Content type hub problem with Blank Site Template
As I mentioned in how to deploy content type hub in my previous blog ("Content Type Hubs Publishing in Sharepoint 2010"), after following blog content type is not appearing on site may required to activate the Taxonomy feature on that site, following command required to activate the feature

STSADM -o activatefeature -id 73EF14B1-13A9-416b-A9B5-ECECA2B0604C -url http:// -force

Power Shell Command 
Enable-SPFeature -id 73EF14B1-13A9-416b-A9B5-ECECA2B0604C -URL

Hope this work for you also.... 

published content types
Remember, as long as the Web Application use the same Metadata Service Application the content type hub is using, it can receive the content types from the hub.
Very neat and useful feature from the SharePoint team!


Changing Content Type Hub URL

Change the Hub URL through powershell by using:

Set-SPMetadataServiceApplication -Identity "" -HubURI ""


For Ex:
Set-SPMetadataServiceApplication -Identity "Managed Metadata Service" -HubURI "http://contenttype.Domain.Com"

When you try to do this you get this rather scary message:

This is SharePoint telling you that this is a major thing so be careful! Essentially all your content types that you have published out will be removed if they can, and you have to republish all of your content types out again which can cause some issue.

No comments:

Post a Comment