How To: Manage the SharePoint 2010 Term Store via Powershell

How To: Manage the SharePoint 2010 Term Store via Powershell

 Work in progress




Introduction

SharePoint 2010 is a great platform in terms of features and functionalities related to the document management area. One of the most important features is the ability for the users and for the administrators to create a well established and structured set of terms that can be used to properly classify all the documents stored in a SharePoint site, thus creating a consistent taxonomy that can be used all over a SharePoint company's implementation and improving search results.
In this article we'll illustrate the main features of the SharePoint Managed Metadata Service (also known as the term store) and how it can be manipulated and managed via Powershell.

Back to top

What is the Term Store?

The term store (whose "real name" is Managed Metadata Services) is a hierarchical collection of terms that can be used to describe various types of items, such as documents and list items. The term store allows for the organization of terms, lists and classifications to be leveraged across multiple SharePoint web applications or site collections.
Managed Metadata Services cam be accessed and managed through Central Administration, Application Management, Manage Service Applications, Managed Metadata Service.

Back to top

Connecting to the Term Store

The first step to take when manipulating the term store is accessing the Managed Metadata service application (or the service applications, since you can have more than one term store in your SharePoint installation) that represents the global term store available in SharePoint and that contains all of the stored terms groups.
Accessing the service application requires using a variable that will store the result of the execution of the Get-SPTaxonomySession cmdlet, that will be passed as a parameter the address of the SharePoint site collection hosting the term store: open the SharePoint Management Shell, type and run the following command

$SPTax = Get-SPTaxonomySession -Site http://siteaddress

The $SPTax variable will store a Microsoft.SharePoint.Taxonomy.TaxonomySession object, containing the set of all the available metadata term stores for the specified site collection. The members (that you can get by piping the Get-Member cmdlet with the $SPTax variable) of the TaxonomySession object will allow you to access all the available term stores wrapped by the object: for example, you can access the site collection default term store by means of the DefaultSiteCollectionTermStore property or you can retrieve the collection of the term stores associated with the web application of the current site collection by means of the collection represented by the TermStores property. Since you must pass through the whole term store hierarchy until get every single stored term set or even term, you need to have a reference to the set of the available term stores. For the sake of convenience and reuse, you can store a reference to the set of term stores in a variable as in the following

$SPTSs = $SPTax.TermStores

By using this reference you can walk through the term store hierarchy, thus accessing the terms groups (and the terms sets and every single term within them) stored in a term store.

Back to top

Getting the Term Groups

 

Back to top

Getting the Term Sets

 

Back to top

Getting the Terms

 

Back to top

Complete Sample: Exporting the Term Store to a XML File

 

Back to top


Community Content


See Also

NOTE: the following links are external to TechNet Wiki.

Back to top


Other Languages

This article is also available in the following languages:

Italian (it-IT)

 

Leave a Comment
  • Please add 7 and 7 and type the answer here:
  • Post
Wiki - Revision Comment List(Revision Comment)
Comments
  • Luigi Bruno edited Original. Comment: Added the "Other Languages" section.

  • Luigi Bruno edited Revision 1. Comment: Filled in the "Introduction" section.

  • Luigi Bruno edited Revision 2. Comment: Edited the "Connecting to the Term Store" section.

  • Luigi Bruno edited Revision 3. Comment: Filled in the "What is the Term Store?" section. Added the "See Also" section.

  • Luigi Bruno edited Revision 4. Comment: Added the "Community Content" section.

Page 1 of 1 (5 items)
Wikis - Comment List
Posting comments is temporarily disabled until 10:00am PST on Saturday, December 14th. Thank you for your patience.
Comments
  • Luigi Bruno edited Original. Comment: Added the "Other Languages" section.

  • Luigi Bruno edited Revision 1. Comment: Filled in the "Introduction" section.

  • Luigi Bruno edited Revision 2. Comment: Edited the "Connecting to the Term Store" section.

  • Luigi Bruno edited Revision 3. Comment: Filled in the "What is the Term Store?" section. Added the "See Also" section.

  • Luigi Bruno edited Revision 4. Comment: Added the "Community Content" section.

Page 1 of 1 (5 items)