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?


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 "username@contoso.onmicrosoft.com" -Password "password"
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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