Recently we attempted to sync the Content Type Hub (CTH) from environment EnvA to environment EnvB. We took a DB backup of the source CTH site collection and restored that to EnvB. We republished the content types and observed that they were pushed out to other site collections in EnvB as expected.
However, we later found an issue where new site collections being created in EnvB are provisioned with content types that we did not expect. These content types no longer exist in the CTH after the restore from EnvA – but did exist prior to that.
It seems that the CTH site collection defines the content types to be published. These definitions are then copied to the Managed Metadata Service, and it is from here that they are pushed out to other site collections. This would explain why new site collections are provisioned with ghost content types: we synced the CTH DB, but did not sync the Managed Metadata Service DB. New site collections on creation continue to get definitions of old content types pushed out to them.
In our case, we did not take a backup of the CTH in EnvB prior to restoring from EnvA. If we did, we would have tried the following steps to fix this issue:
- Unpublish all content types in CTH in EnvB prior to restoring from EnvA
- Run the Content Type Hub timer job
- Restore CTH database from EnvA to EnvB
- Republish all content types in CTH in EnvB
In the end we fixed this issue with the following steps:
- Change the CTH URL of Managed Metadata Service to a temporary URL. We had no problems using a temporary invalid URL. You can do this using the PowerShell below (replace the service name and the URL to match your scenario).
Set-SPMetadataServiceApplication -Identity "Managed Metadata Service" -HubURI "http://myServer/dummyCTH"
- Uncheck the “Consumes content types from the Content Type Gallery at http://myServer/dummyCTH” and “Push-down Content Type Publishing updates from the Content Type Gallery to sub-sites and lists using the content type” settings for the Managed Metadata Service in Central Admin.
- Create a new site collection and verify that the ghost content types are no longer being provisioned.
- Change the CTH URL of Managed Metadata Service back to the correct URL.
- Check the two settings above in Central Admin.
- Republish all content types in the CTH. You can do this using the PowerShell at this page http://www.mice-ts.com/force-a-publish-of-content-types-in-a-content-type-hub-using-powershell/.
- For good measure, run the Content Type Hub timer job.
- Create a new site collection and test.