PowerShell for SharePoint (on-prem), SharePoint 2013, SharePoint 2016

Create the Content Type Hub in SharePoint Server (GUI & PowerShell)

Today’s post will be a bit long. But at the end, you’ll understand what is the Content Type Hub, its purpose, and how to create it in 2 different ways!

Content what?

In order to understand the purpose of the Content Type Hub, we first need to understand Content Types.
This is a rather confusing topic for many of us, but content types are used to provide more information about an object/item, and allow us to associate some actions with that content type (i.e.: Workflows)
To get started with Content Types, have a look at Introduction to content types and content type publishing.

Content Types are only available hierarchically, and also, only within a particular Site Collection.
So if we want to share Content Types, that’s when the Content Type Hub comes into play 🙂

What is the Content Type Hub for?

The Content Type Hub allows us to “bypass” the boundaries of Site Collections, and share/publish content types with other site collections, and even other SharePoint Farms.
As long as the Web Applications are connected to the Managed Metadata Service Application hosting the CTHub, they can consume the content types.
Therefore, we avoid doing things over and over again, by NOT creating the same content types multiple times!


Note
:
This article is NOT applicable to SharePoint Online (in Office 365) as the Content Type Hub is already created when provisioning the tenant.
It’s just hidden, but accessible at the following URL: https://<TENANT_NAME>.sharepoint.com/sites/contenttypehub

 

Minimum requirements:

  • Access to SharePoint Central Admin
  • Managed Metadata Service Application created
  • Permissions to manage the Managed Metadata Service Application
  • Permissions to run PowerShell cmdlets

 

Create the Content Type Hub via Central Admin (GUI)

The Content Type Hub is nothing more than a Site Collection.
Meaning we can create it on a existing Web Application, or create a new Web Application to host the Content Type Hub site collection. Your choice!

In this post, we will create the Content Type Hub into a existing Web Application called “Portal”.

  • Navigate to SharePoint Central Admin
  • Under Application Management >> Create site collections”
  • Make sure you are under the desired Web Application at the top >> Fill the information (mine below as a reference)
    • Web Application = http://portal.exams.net
    • Title = Content Type Hub
    • Description = This is the site collection for the CTHub
    • URL = http://portal.exams.net/sites/cthub
    • Template = Team Site

Then click “OK

 

We now need to activate the Content Type Syndication Hub feature on this site collection, to make it the CTHub.

  • Browse to the CTHub site collection (mine is: http://portal.exams.net/sites/cthub)
  • Gear icon (top right) >> Site Settings
  • Under Site Collection Administration >> Site collection features
  • Activate the Content Type Syndication Hub feature
ActivateFeature
Activate the CTHub Syndication feature

 

Perfect! Now let’s connect the CTHub site collection to the Managed Metadata Service Application.

  • Back to Central Admin
  • Under Application Management >> Manage service applications
  • Highlight the MMS application >> Click on “Properties” in the ribbon
MMSProps
Managed Metadata SA

 

  • At the bottom of the page >> Enter the URL of the Content Type Hub
  • Click “OK
CTHubURL
Content Type Hub URL

IMPORTANT:
Once you click on “OK”, the URL will NOT be changeable by going back the same way. PowerShell will need to be used!

 

 

  • Highlight the MMS Proxy
  • Click on “Properties” in the ribbon
  • Select “Consumes content types from the Content Type Gallery at <YOUR_CTHub_URL>
MMSConsumeCTHub
MMS to consume CTHub URL

 

Verification

From a client machine, with a Site Collection Admin user:

  • Browse to a Site Collection >> Site Settings
  • Under Site Collection Administration >> Click on Content Type Publishing
  • Note the URL under “Hubs” >> http://portal.exams.net/sites/cthub/_layouts/15/mngctype.aspx

 

And that’s it!
The Content Type Hub is now created and available for you to publish Content Types beyond their respective site collections 🙂

 

 

 

Create the Content Type Hub using PowerShell

We are going to follow the exact same pattern here, as we did above via Central Admin (GUI)

  • Create the Content Type Hub site collection (under the existing “Portal” Web Application),
  • Activate the Content Type Syndication Hub feature on the site collection,
  • Associate the Content Type Hub with the Managed Metadata Service Application
  • Update the MMS Proxy (connection) to consume the Content Type Gallery from the CTHub URL

 

As usual, adapt the script with your environment.

#Create the CTHub site collection
$newSPSiteSplat = @{
    Url = 'http://portal.exams.net/sites/PScthub'
    Description = "This is the site collection for the CTHub"
    Template = "STS#0"
    OwnerAlias = "exams\SPInstall"
    Name = "Content Type Hub"
    Language = 1033
    ContentDatabase = "SP2016_Portal_DB"
}
New-SPSite @newSPSiteSplat

#Enable Content Type Hub feature
Enable-SPFeature -Url "http://portal.exams.net/sites/PScthub" -Identity ContentTypeHub

 

PSSiteColCreated
Site collection created with PowerShell

 

PSFeatureActivated
Feature activated

 

It’s now time to associate the CTHub URL with the Managed Metadata Service Application using the Set-SPMetadataServiceApplication cmdlet:

#Add the CTHub URL to the MMS Application
$MMS = Get-SPServiceApplication | Where-Object {$_.TypeName -eq "Managed Metadata Service"}  
$CTHubURL = "http://portal.exams.net/sites/PScthub"

Set-SPMetadataServiceApplication -Identity $MMS -HubUri $CTHubURL

 

CTHubAssociatedWithMMS
Content Type Hub associated with MMS

 

Update the Managed Metadata Service Proxy (connection) to consume from the CTHub URL with the Set-SPMetadataServiceApplicationProxy cmdlet:

#MMS Proxy consume CTHub & Push down Content Types
$MMSProxy = Get-SPServiceApplicationProxy| Where-Object {$_.TypeName -eq "Managed Metadata Service Connection"}  

Set-SPMetadataServiceApplicationProxy -Identity $MMSProxy -ContentTypeSyndicationEnabled -ContentTypePushdownEnabled

 

Confirm the action, and check the results!

ConsumeCTHub
Consume CTHub

 

That concludes the topic for today, I know it was a bit long, but I hope it was worth your time 🙂

 

 

Loading Likes... Tagged , , , , ,

Leave a Reply