SharePoint Online: Update Term Set Properties (Name, Description, Tagging Options, etc.) using PowerShell
Requirement: Change Term Set properties such as Name, Description, Tagging, etc., using PowerShell in SharePoint Online.
How to Update Term Set Properties in SharePoint Online?
Term Sets in SharePoint Online are collections of related terms used to categorize and classify content on a site. By updating these Term Sets, you can keep your taxonomy up-to-date and ensure that it accurately reflects the organization and categorization of your content. In this article, we’ll walk you through the process of updating a Term Set in SharePoint Online.
To update a term set in SharePoint Online, you can follow these steps:
- Go to your SharePoint Online Admin Center >> Expand “Content Services” and click on “Term Store”.
- In the Term Store Management page, Navigate to the Term Group and select the Term Set you want to update.
- Click on the “Rename Term Set” button in the toolbar to update the name and description for the selected term set.
- You can also set various properties available on the term set properties such as “Available for navigation”, “Available for Tagging”, etc.
- When you’re done making changes, click the “Save” button to save your changes.
Note that you must have Term store Administrator permissions to access the Term Store Management page and edit Term Sets.
SharePoint Online: Set Term Set Name, Description, and Tagging Options using PowerShell
In this blog post, we will be looking at how you can use PowerShell to update a Term Set in SharePoint Online. This can come in handy if you need to change a Term Set through scripting instead of the standard browser interface.
Here is how to update a term set in SharePoint Online using PowerShell:
#Load SharePoint CSOM Assemblies
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Taxonomy.dll"
#Set Variables
$SiteURL= "https://crescent.sharepoint.com"
$TermGroupName = "Sectors"
$TermSetName = "Energy"
$TermSetNewName = "Energy Sector"
$TermSetDescription = "Term Set for Energy Apps"
$AvailableForTagging = $False
#Setup Credentials to connect
$Cred = Get-Credential
Try {
#Setup the context
$Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
$Ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.UserName,$Cred.Password)
#Get the Taxonomy Session and Term Store
$TaxonomySession = [Microsoft.SharePoint.Client.Taxonomy.TaxonomySession]::GetTaxonomySession($Ctx)
$TaxonomySession.UpdateCache()
$Ctx.Load($TaxonomySession)
$TermStore = $TaxonomySession.GetDefaultSiteCollectionTermStore()
$Ctx.Load($TermStore)
$Ctx.ExecuteQuery()
#Get the Term Group
$TermGroup = $TermStore.Groups.GetByName($TermGroupName)
$Ctx.Load($TermGroup)
#Get the Term Set
$TermSet = $TermGroup.TermSets.GetByName($TermSetName)
$Ctx.Load($TermSet)
$Ctx.ExecuteQuery()
#Set Term Set Name, description, Available For Tagging options
$Termset.Name = $TermSetNewName
$TermSet.Description = $TermSetDescription
$TermSet.IsAvailableForTagging = $AvailableForTagging
$Ctx.ExecuteQuery()
Write-host -f Green "Term Set Settings Updated Successfully!"
}
Catch {
write-host -f Red "Error: " $_.Exception.Message
}
PnP PowerShell to Update Term Set in SharePoint Online
PnP PowerShell makes it much simpler! By using PnP PowerShell, you can automate the process of updating Term Sets in SharePoint Online:
#Parameters
$AdminCenterURL = "https://crescent-admin.sharepoint.com"
#Connect to PnP Online
Connect-PnPOnline -Url $SiteURL -Interactive
#Update Term set Name and description
Set-PnPTermSet -Identity "Africa" -TermGroup "Regions" -Name "African" -Description "African Continent"
#Update Term Set Tagging and Navigation options
Set-PnPTermSet -Identity "Top Navigation" -TermGroup "Global Top Navigation" -IsAvailableForTagging $True -UseForSiteNavigation $True
Conclusion:
By following the steps outlined above, you can easily update a Term Set in SharePoint Online to keep your taxonomy accurate and current. Whether you’re adding new terms, editing existing ones, or updating the properties of the Term Set itself, the process is straightforward. By regularly updating your Term Sets, you can ensure that your SharePoint Online site remains organized, well-structured, and easy to navigate. By automating the process with PowerShell, you can save time and effort.