Delete a Term in a TermStore using PowerShell:
function Delete-SPTerm($SiteUrl, $TermStoreName, $TermName) { Start-SPAssignment -Global try{ $site = Get-SPSite $SiteUrl $session = new-object Microsoft.SharePoint.Taxonomy.TaxonomySession($site) $termstore = $session.TermStores[$termStoreName] $terms= $termstore.GetTerms($termName, $false) if($terms.Count -gt 0){ $terms[0].Delete() $termstore.CommitAll() Write-Host 'Term deleted!' }else{ Write-Host 'Term not found!' } } finally { Stop-SPAssignment -Global } }Use example:
Delete-GroupTerm -SiteUrl "" -TermStoreName "" -TermName ""
Comments