How can I delete all Enterprise Keywords in our Sharepoint Online. It seems that the Term Store is already populated with many, many entries.

Is there a way to "reset" or delete all Enterprise keywords?

In GUI, I can't find a "Delete ALL"-Button. How about powershell? Does some have a script?

1 Answer 1


How to delete Enterprise Keywords using SharePoint CSOM in PowerShell

Clear-Keywords.ps1 PS script:

param (


Function Get-SPOCredentials([string]$UserName,[string]$Password)
    $SecurePassword = $Password | ConvertTo-SecureString -AsPlainText -Force
    return New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($UserName, $SecurePassword)

Function Clear-Keywords([Microsoft.SharePoint.Client.ClientContext]$Context)
    $taxSession = [Microsoft.SharePoint.Client.Taxonomy.TaxonomySession]::GetTaxonomySession($Context)
    $termStore = $taxSession.GetDefaultKeywordsTermStore()
    $keywords = $termStore.KeywordsTermSet.Terms

    $keywords | % { $_.DeleteObject() }

$context = New-Object Microsoft.SharePoint.Client.ClientContext($Url)
$context.Credentials = Get-SPOCredentials -UserName $UserName -Password $Password
Clear-Keywords -Context $context


.\Clear-Keywords.ps1 -Url "https://contoso.sharepoint.com/" -UserName "[email protected]" -Password "password"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.