Delete Term Sets, Terms, and Term Groups in SharePoint

Introduction

In SharePoint Online, a well-organized and structured information architecture is crucial for efficient content management and navigation. One of the key components of this architecture is taxonomy, which consists of terms, term sets, and term groups. However, as your SharePoint environment evolves, you may find the need to delete outdated or redundant taxonomy elements to maintain its effectiveness. In this blog post, we'll explore how to delete term sets, terms, and term groups in SharePoint Online, ensuring your taxonomy remains streamlined and optimized.

Steps to remove a term set in SharePoint Online

  1. login to SharePoint Online Admin Center: Go to your SharePoint Online admin center site. (e.g., https://yourdomain-admin.sharepoint.com).
  2. Access Term Store: Expand the "Content services" section and click on "Term store" in the left navigation menu.
  3. Delete Term Set: Navigate to the term set you want to delete. Right-click on the term set and select "Delete term set" from the context menu.
    SharePoint Admin Center
  4. Confirmation: Confirm the deletion by clicking "Delete" in the confirmation popup. All terms under the deleted term set will be removed, and any terms in use will be moved to "Orphaned terms" under the "System" term group.
    Delete term set

Steps to remove Terms in SharePoint Online

  1. Access Admin Center: Go to your SharePoint Online admin center site. (e.g., https://yourdomain-admin.sharepoint.com).
  2. Navigate to Term Store: Click on "Content services" and then select "Term store" from the left menu.
  3. Locate Term: Expand the taxonomy tree to find the term you want to delete.
  4. Delete Term: Click on the three dots in the Term Header and choose "Delete Term." Confirm the deletion prompt.Term store

Steps to remove a Term Group in SharePoint Online

  1. Access Admin Center: Log in to your SharePoint admin center site (e.g., https://yourdomain-admin.sharepoint.com).
  2. Navigate to Term Store: Click on " Content Services" and then select "Term Store" from the left navigation menu.
  3. Select Term Group: From the taxonomy tree view, choose the term group you want to delete.
  4. Delete Term Group: Click on the three dots in the Term Group Header and choose "Delete Term Group."
    Navigate to Term Store
  5. Resolve Errors (if any): If there are terms in the group, you'll receive an error message indicating that the group cannot be deleted until all term sets are removed. You'll need to delete or move all term sets from the group before attempting to delete the group again.
    Delete term group

Deletion Taxonomy Management in SharePoint Online with PowerShell

Prerequisites

Before getting started with PnP PowerShell for taxonomy management, ensure that you have

Installed the PnP PowerShell module.

Necessary permissions to manage taxonomy (e.g., Term Store Administrator).

Deleting a Term Using PnP PowerShell

To delete a specific term in SharePoint Online using PnP PowerShell, follow these steps.

  1. Open PowerShell and connect to your SharePoint Online environment.
  2. Use the Remove-PnPTerm cmdlet to delete the term by ID or by specifying the term itself.
  3. Confirm the deletion when prompted.
    # Connect to SharePoint Online
    Connect-PnPOnline -Url https://yourtenant-admin.sharepoint.com -Interactive
    
    # Delete the term by ID
    Remove-PnPTerm -Identity "GUID_of_the_term" 
    
    # Delete the term by Name
    Remove-PnPTerm -Identity "Name_of_the_term" -TermSet "Name_of_the_termset" -TermGroup "Name_of_the_termgroup"

Deleting a Term Set Using PnP PowerShell

Deleting a term set in SharePoint Online with PnP PowerShell is straightforward.

  1. Connect to your SharePoint Online environment.
  2. Remove-PnPTaxonomyItem is the cmdlet used to remove a taxonomy item, such as a term or term set.
  3. TermPath specifies the path of the term set to delete.
  4. A force parameter is used to force the deletion without confirmation prompts. This ensures that the deletion process runs without interruption.
    # Connect to SharePoint Online 
    Connect-PnPOnline -Url https://yourtenant-admin.sharepoint.com -Interactive
    
    #Delete the Term set 
    Remove-PnPTaxonomyItem -TermPath "Termset_Name|TermGroup_Name" -Force
    

Deleting a Term Group Using PnP PowerShell

Deleting a term group follows a similar pattern.

  1. Connect to your SharePoint Online environment.
  2. Use the Remove-PnPTermGroup cmdlet to delete the term group by name or by specifying the term group itself.
  3. Confirm the deletion when prompted.
    # Connect to SharePoint Online
    Connect-PnPOnline -Url https://yourtenant-admin.sharepoint.com -Interactive
    
    # Delete the term group by name
    Remove-PnPTermGroup -Identity "Name_of_the_TermGroup"  -Force
    
    # Delete the term group by ID
    Remove-PnPTermGroup -Identity "GUID_of_the_TermGroup" -Force
    

Conclusion

Deleting a term, term set, or term group in SharePoint Online can help maintain a clean and organized information architecture, improving the usability and efficiency of your SharePoint sites. By following the step-by-step guide outlined above, you can confidently remove unnecessary term sets while ensuring that your taxonomy remains aligned with your organization's evolving needs.

PowerShell empowers SharePoint Online administrators to automate and streamline taxonomy management tasks efficiently. By leveraging PowerShell cmdlets, you can delete individual terms, term sets, or entire term groups with precision and ease.