{"id":3489,"date":"2012-02-07T17:23:38","date_gmt":"2012-02-07T17:23:38","guid":{"rendered":"https:\/\/test.simple-talk.com\/uncategorized\/getting-the-url-to-the-content-type-hub-programmatically-in-sharepoint-2010\/"},"modified":"2016-07-28T10:50:42","modified_gmt":"2016-07-28T10:50:42","slug":"getting-the-url-to-the-content-type-hub-programmatically-in-sharepoint-2010","status":"publish","type":"post","link":"https:\/\/www.red-gate.com\/simple-talk\/blogs\/getting-the-url-to-the-content-type-hub-programmatically-in-sharepoint-2010\/","title":{"rendered":"Getting the URL to the Content Type Hub Programmatically in SharePoint 2010"},"content":{"rendered":"<p>Many organizations use the content-type hub to manage content-types in their SharePoint 2010 environment.&#160; 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.&#160; Here is a quick snippet that demonstrates how to do it fairly painlessly:<\/p>\n<p><code>public static Uri GetContentTypeHubUri(SPSite site)      <br \/>{       <br \/>&#160;&#160;&#160; TaxonomySession session = new TaxonomySession(site);       <br \/>&#160;&#160;&#160; return Session.<\/code><code>DefaultSiteCollectionTermStore     <br \/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; <\/code><code>.ContentTypePublishingHub;     <br \/>}<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Many organizations use the content-type hub to manage content-types in their SharePoint 2010 environment.&#160; 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.&#160; Here is a quick snippet that demonstrates how to do it fairly painlessly: public static&#8230;&hellip;<\/p>\n","protected":false},"author":46738,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[2],"tags":[],"coauthors":[],"class_list":["post-3489","post","type-post","status-publish","format-standard","hentry","category-blogs"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/3489","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/users\/46738"}],"replies":[{"embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/comments?post=3489"}],"version-history":[{"count":2,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/3489\/revisions"}],"predecessor-version":[{"id":42122,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/3489\/revisions\/42122"}],"wp:attachment":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/media?parent=3489"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/categories?post=3489"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/tags?post=3489"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/coauthors?post=3489"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}