M365 Dev Blog

Copy all SharePoint terms in a term set to clipboard

copy terms

This is just one of those blog posts where there is no “rocket science” if you use the right tools. And the reason why I’m writing it is to just show how easy it is. All it takes is one line of PowerShell to copy all terms in a term set to the clipboard.
Of course there is a lot of “rocket science” here. But it’s inside PnP PowerShell and we don’t need to worry about it!

I use PnP PowerShell very often and I sometimes publish posts with useful scripts. You can find an example here to update metadata fields.

How many times have people asked you for a list of all the SharePoint managed metadata terms within a specific term set? They can simply access the term store, but let’s be honest, the user interface is not great at the moment…

Well, next time you get that request, simply connect to SharePoint using PnP PowerShell and then run the following command to copy all terms to the clipboard

Get-PnPTerm -TermSet "MyTermSet" -TermGroup "MyTermGroup" | Select Name | clip

Paste the result, for example, into an Excel file and the information is ready to be consumed.
Please note that the snippet above extracts a flat list of terms and does not include child terms.

Enjoy!

Exit mobile version