Click here to monitor SSC

Caffeine Induced Tirades about .NET and Life

Getting the URL to the Content Type Hub Programmatically in SharePoint 2010

Published 7 February 2012 5:23 pm

Many organizations use the content-type hub to manage content-types in their SharePoint 2010 environment.  As a developer in these types of organizations, you may one day find yourself in need of getting the URL of the content type hub programmatically.  Here is a quick snippet that demonstrates how to do it fairly painlessly:

public static Uri GetContentTypeHubUri(SPSite site)
{
    TaxonomySession session = new TaxonomySession(site);
    return Session.
DefaultSiteCollectionTermStore
       
.ContentTypePublishingHub;
}

One Response to “Getting the URL to the Content Type Hub Programmatically in SharePoint 2010”

  1. [...] is something I came across in Damon Armstrong’s blog a long time back but never got around to writing about it before. Share this:Like this:LikeBe the [...]

Leave a Reply