Posted on:
Categories: SharePoint

When maintaining a SharePoint term set, you may need to know where a particular term has been used, and to cover all possible taxonomy fields. This typically happens when someone wishes to deprecate or even delete a term but is unsure of how it is presently being used. 

Here's a quick way to check farm-wide, u​​sing search. Note that, since search results are security-trimmed, this is only definitive if run under an account that has read access to all content, so you may want to ask a suitably-authorised​ person to run the query.

A No-code Approach

At your organization's main search centre, enter the following in the search box, where the 2nd half is the ID of the term.


Note the prepended zero after the colon.

This will return all objects tagged with that term in any field.

More Control with Powershell and CSOM

​The following script, which assumes SP 2013, does the same thing but means you're not at the mercy of the settings in your search centre. It also serves as a general example of how to execute search queries using CSOM from PowerShell 3+.

        [Parameter(Mandatory = $true)][string]$url,
        [Parameter(Mandatory = $true)][guid]$termId


$ctx = New-Object Microsoft.SharePoint.Client.ClientContext($url)
$ctx.Credentials = Get-Credential
$keywordQuery = New-Object Microsoft.SharePoint.Client.Search.Query.KeywordQuery($ctx);
$keywordQuery.QueryText = "owstaxidmetadataalltagsinfo:0{0}" -f $termId
$keywordQuery.SourceId = [guid]"8413cd39-2156-4e00-b54d-11efd9abdb89" # Local SharePoint Results
$searchExecutor = New-Object Microsoft.SharePoint.Client.Search.Query.SearchExecutor($ctx);
$resultTables = $searchExecutor.ExecuteQuery($keywordQuery);

foreach($resultTable in $resultTables)
    foreach($resultRow in $resultTable.Value.ResultRows)
        Write-Output "$($resultRow.Title): $($resultRow.Path)"