Removal of Content Type Hub (MS Non-Compliant)

So today for a non-compliant post. Spence has done it. So why can’t I if I know the way MS envisions it just doesn’t work? You decide if you want to use it at your own risk.

The situation is as follows: I have a manageed metadata service and a content type hub associated with it. The site no longer exists but the reference still does. So I have a farm that doesn’t even host a web application with that url. The managed metadata service application was migrated from 2010 to 2013 as a basis for the content move that will come later. The site doesn’t exist either on 2010 nor on 2013 anymore.

I expect the following happend: you may activate the content type hub feature somewhere and then you have it registered in your managed metadata service (you can see it if you highlight the service application in the overview page of central admin (not the proxy!) and select the properties ribbon control. You will have a box where to enter the content type hub (if there is none defined) or text showing the url of the content type hub. Then you move the site collection and expect the box to appear again, but no! The reference persists.

So there is no way of removing the URI via UI because the text is showing and not the textbox. How are you going to get rid of this metadata service property? How are you going to reset the value?

There is actually a powershell command to do this.

$mmd = get-spserviceapplication | ? { $_.DisplayName -eq "My Managed Metadata Service" }
Set-SPMetadataserviceapplication -identity $mmd -HubUri ""

You can even be generous and add

$mmd.Update()

Don’t worry. it won’t work anyway. Not even an error. And that’s where even I get cranky. Come on, MS. Be a bit more talkative here, please! This is SharePoint 2013 for crying out loud. At least if you don’t check if the site exists before using the property, at least give me something to work with in form of an error.

So I did this for the last 2 hours checking out what else I could do. Then I thought: well, thanks for nothing I am going into the db. Maybe it’s as easy as setting a NVP (NameValue-Pair). So I check my database associated with the Service Application. I check the only table that makes sense: ‘dbo.ECMServiceSettings’

Okay…give it to me! What do I get? An encoded xml snippet. Two of them! For each PartitionId one!

Just one of the xml snippets had a value for the contenttype hub and “coincidentally” the url I knew it should have so I went ahead and tried the following. This is picking the content of the settings field and replacing HubUri="[This was where my url was]" with HubUri="".

UPDATE [Managed Metadata Service Database].[dbo].[ECMServiceSettings]
SET Settings = '<?xml version="1.0" encoding="utf-16"?><MetadataSettings TSId="79d13525-d2de-49a4-8f66-6b8d3aa8054e" RptOn="false" HubUri="" CacheSec="10" MaxChan="3" />'
WHERE PartitionId = 'PartitionId'

Interestingly there are no side effects (yet!). Again, I do not recommend this, I just tried it on a non-productive machine and it works. I did not find any other way how to do it and a content type hub that doesn’t exist is just as bad as if there is no reference in the first place. Maybe a good way of doing it would be to activate the content type hub feature on a new site collection and register this site collection and then try it the recommended way. That means first deactivating the feature on the site collection, then deleting the site collection and then setting the hubUri empty.

The best way is of course to try and avoid that situation altogether or write a feature to have a content type created instead of publishing the content types via a content type hub. It’s known since 2010 already that Metadata in general is not as stable as the rest of the product. It’s a quick and dirty implementation of a sensible feature. I wish a CU or SP would do away with the issues but even the new release of 2013 did not help.

I leave you with this bitter afterthought and hope you never get to this point.

Advertisements

One Response to Removal of Content Type Hub (MS Non-Compliant)

  1. JeroenS says:

    OMG .. I need this.. on production… My problem is this.. i’ve got 2 Managed Metadata Services, the one is hosting the content-type-hub (HUBservice), the other one is hosting the term-store (MMS). Now some site collections in the WebApp are not using the HUBService to receive content types from but the MMS. Which means, they are not receiving updated content types šŸ˜¦ The error-publishing-log actually says:
    Content type [] has been published from service application MMS and HUBService.
    MMS was used.

    So.. maybe.. if I remove the URI from the MMS Service App… it starts using the HUBService.. .(fingers crossed)

    Thanks again so much !
    Jeroen

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: