Home > SharePoint, SharePoint 2010 > SharePoint 2010: Reinstalling and publishing content types in the Content Type Hub may be automatically unpublished

SharePoint 2010: Reinstalling and publishing content types in the Content Type Hub may be automatically unpublished


I recently setup PowerShell scripts to automate the uninstall and then install of our SharePoint solutions and features, including content types published in the Content Type Hub.

When installing new content types in the Content Type Hub, they are then published via a feature.

When uninstalling those content types from the Content Type Hub a feature first unpublishes the content type then uninstalls it completely from the Content Type Hub.

During development we repeatedly uninstall old versions and install new versions of our solutions via PowerShell for quick and reliable deployment. However the published content types in the Content Type Hub have been playing up.

For a while I would uninstall the old and install the new straight afterwards then confirm that the content types are actually published according to the Content Type Publishing page in the Content Type Hub. A few minutes later I would then find that the content types are no longer published and consequently any newly created sites that expect to receive these published content types from the Content Type Hub would fail.

After a while I started to have suspicions on what causes this, and managed to confirm this through the ULS logs. The ULS logs showed that each content type was unpublished by the Content Type Hub timer job, as shown in the ULS log as “Timer Job MetadataHubTimerJob”, with the following 3 significant lines in the ULS log showing for each content type affected:

Unpublishing content type to term store decb8a76-915d-4aee-85a0-31f3c4e4af1b
Unpublished the content type on term store decb8a76-915d-4aee-85a0-31f3c4e4af1b
UnpublishContentType ends for content type 0x0101007F645D6FBA204A029FECB8BFC6578C39004272853530254253B836F53191842A7B

This was happening despite having reinstalled these (same or updated) content types and having published them again after install.

It looks like having set the content types to be unpublished before uninstalling them, the timer job eventually activates on its normal schedule and goes ahead with the unpublishing even if they have been reinstalled and published again.

The solution appears to be if having to reinstall and publish content types, then after uninstall, either wait for the ‘Content Type Hub’ timer job to run and complete or force it to run now, then continue with the install and publish the content types. Having taken this timer job into account the deployments appear to have stopped unpublishing the content types unexpectedly after reinstall.

Advertisements
  1. Kalpana
    September 20, 2013 at 08:52

    Excellent tip !!! Same happened with me. Running the timer job after Removing the solution and running it back after installing the features fixed it :)
    Thanks a lot

  1. No trackbacks yet.

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 )

Google+ photo

You are commenting using your Google+ 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 )

Connecting to %s

%d bloggers like this: