Subscribe:      
 

Automating Content Type Publishing with PowerShell

Written By: Chris Beckett -- 8/17/2011 -- join -- contribute -- (470) comments -- printer friendly version

Rating: Rate --

Categories: Configurations, Document Management, PowerShell, SharePoint 2010, SharePoint Foundation 2010

< Prev - 1 | 2 | - Next > | Become a paid author

Problem

In SharePoint 2010, the Managed Metadata Service provides the ability to publish content types from a central location called a hub. In my tip "Publishing Content Types with the Managed Metadata Service", I demonstrated how to configure content type publishing through the SharePoint User Interface. In this companion tip, I will demonstrate how to automate the configuration of the Managed Metadata Service hub, and the publishing of content types through PowerShell. 

Solution

The Managed Metadata Service in SharePoint 2010 is a new service application that provides the ability to publish content types across all site collections within all web applications that are connected to the service.

Step 1 - Set the Managed Metadata Service Hub Location

Each instance of a Managed Metadata Service application can optionally be configured with a content type hub. A hub is an associated site collection that is used to publish content types that can be consumed through a web application service connection. Any kind of site collection (Blank, Team) template can be used as a content type hub, but only a single site collection can be configured as the hub for each instance of a Managed Metadata Service application.

$HubUrl = "http://sharepoint/system/metadatahub"
$ServiceName = "Managed Metadata Services"

Get-SPServiceApplication | ForEach-Object `
{
    if ($_.DisplayName -eq $ServiceName)
    {
        Set-SPMetadataServiceApplication -Identity $_ `
            -HubURI $HubUrl
    }
}

Since the display name of each service application is unique, in the code snippet above, I search for the display name of the Managed Metadata Service application instance I want to update, and then update the hub location with the URL of a site collection that will be the associated content type hub used for publishing.

< Prev - 1 | 2 | - Next >



Learn more about SharePoint



Sponsor Information




Copyright (c) 2010-2017 Edgewood Solutions, LLC All rights reserved
privacy | disclaimer | copyright | advertise | contribute | feedback | about
Some names and products listed are the registered trademarks of their respective owners.


MSSharePointTips.com | MSSQLTips.com