SP2010: Using the content type hub across web applications

The Enterprise Content Hub (ECH) is a SharePoint mechanism which allows us to reuse / distribute content types across multiple site collections. Normally, a site content type (what’s in a name), is bound to the site collection in which it was defined. Actually, when defining a content type on a lower level (subsite), it can only be used downwards on that site and it’s subsites, not upwards.

The ECH functionality, which is part of the managed metadata service, allows us to create shared content types which are then published to all site collections subscribed to that particular content type hub. There is one problem though: templates.

As long as your content types are not distributed to other web applications, you’re fine. But as soon as they are; you’ll notice this won’t work. This is because the link to a template file is stored as a relative URL. Suppose you link to: http://contoso-a.com/docs/template.dotx, this will be stored as /docs/template.dotx. Now when your content type travels to a different web application with the URL http://contoso-b.com,  the link will break because the file doesn’t exist at http://contoso-b.com/doc/template.dotx.

The answer to this nasty problem is quite simple: make sure the file exists at the same relative location in the other web application as well. This means you need to do two things:

  1. Store your template files in a site collection which you create with exactly the same URL in all web applications. This can be the root site collection (/), but doesn’t have to be. You can use something like /sites/templates for instance. Of course; your users need read access to all of those libraries.
  2. Use a mechanism which syncs up these libraries automatically, so you only have to maintain one of them. I use DocAve to do this, but there are numerous ways of syncing two document libraries (Powershell scripts can be found online).

Now with our previous example; there will be a template file present at http://contoso-a.com/docs/template.dotx, so the content type in the second web application will not break.

I admit it’s a little workaround for a problem which shouldn’t have been there in the first place, but al least this enables you to use content types with templates throughout your farm!

 

, , ,

Related posts

Latest posts

Leave a Comment

Leave a Reply

Your email address will not be published. Required fields are marked *