PNP PowerShell: Maintain all your Termset data across tenants

The Term store manager available in SharePoint enables companies to manage their enterprise-specific taxonomy easily through new term groups and term sets. This metadata can then be referenced by users for selecting choices when filling in profile or content-related data.

Enterprise taxonomies can sometime contain dozens of groups with too many term sets and terms to manage, update of copy manually. There are standard ways offered to export taxonomies into a .csv file and importing them to term store on a different tenant.

But what if you want to not only export term sets and term labels but also their other term-specific data and configuration such as:

  • Localised labels for each term
  • Synonyms
  • Navigation settings (if the term set is intended for site navigation)
  • Custom properties associated with each term
  • The exact GUID of the term

The above data may not be interesting for users, however for administrators and content creators and developers these additional elements of a term can are very important.

Fortunately, we can export all the term sets configuration using the powerful and very useful PNP PowerShell cmdlets

Thanks to the efforts in the Microsoft Patterns & Practices (PnP) community, we now have a set of useful PowerShell cmdlets that can help us. The list of cmdlets is continuously growing and we find that as administrators we can accomplish many more tasks using CSOM

Specifically, the cmdlet that we can use is:

Export-PNPTermGroupToXml – Enables us to export a Term group and all its underlying terms’ setting to an xml-based output file

ImportPnPTermGroupFromXml – Enables us to import a Term group from an XML file

Export your taxonomy

To use the cmdlet, I first need enter credentials connect to my SPO tenant content type hub site collection:

Once connected I simply need to pass an output file and the term group name I want to export

Looking at the exported XML you can see that all the relevant term settings included GUID are now available to import to another term store

Importing your taxonomy

The import is done in a similar manner.

Connect to the destination tenant

Pass the XML file as a parameter as seen below

That’s it!