Programatically deprecating SharePoint Terms

My pie, four years ago

Happy Pi day! As a follow up to last weeks post on managing the SharePoint term store using PowerShell and a SharePoint list, my pull request was accepted and made it into version 1.4.0 of PnP.Powershell.

That means you can now (un)deprecate terms in the store using the new -deprecated parameter on Set-PnPTerm.

In our implemnentation we use a boolean (yes/no) column called ‘Active’ in the source SharePoint list. This conditional then sets the deprecation state:

1
2
3
4
5
6
7
8
9
if($item.FieldValues["Active"] -eq "Yes"){
	$t = Set-PnPTerm -Identity $termGUID -deprecated $false 
		-TermSet $destTermSet -TermGroup "GroupName"
	Write-Verbose -Message "Undeprecated Term: $($item.FieldValues.Title)"
} else {
	$t = Set-PnPTerm -Identity $termGUID -deprecated $true 
		-TermSet $destTermSet -TermGroup "GroupName"
	Write-Verbose -Message "Deprecated Term: $($item.FieldValues.Title)"
}

All that’s remaining is to be able to move terms. I have some code for that, but there are a lot of edge cases that still require more testing.