Create a SharePoint taxonomy using an XML file and PowerShell

Today is all about SharePoint taxonomy with PowerShell PnP!
In a nutshell, taxonomy is a hierarchical group of term sets & terms, that is provided by SharePoint when configuring the Managed Metadata Service Application (MMS). Creation of terms is done via the Term Store in SharePoint Server (when MMS is configured), and is also available in SharePoint Online.
For more information about SharePoint taxonomy, get started with the following links:
Create / import taxonomy from an XML file
Importing multiple Term Groups, Term Sets, and Terms contained in an XML
file.
I like the XML
structure because it feels neat and organised…. And a simple notepad++ is enough 🙂
We would need to know the XML
syntax, but it is also possible using a .TXT
format, or even arrays if you feel more comfortable this way.
Note: If you log into O365 and navigate to the Term Store, under “Sample Import”, Microsoft gives you a link to download a sample of what a .csv
file would look like.
So my XML
file is structured like the following:
Now, let’s use the Import-PnPTermGroupFromXml to get our taxonomy to SharePoint Online. Two (2) ways to use this cmdlet:
Import-PnPTermGroupFromXml -Xml <xml file variable>
Import-PnPTermGroupFromXml -Path <location of the XML file>
If all went well, we should see our taxonomy in SPO!
Thanks for reading!