Forum Discussion

miguelisidoro's avatar
miguelisidoro
Iron Contributor
Oct 18, 2022

How to delete a term from term store using PnP JS

Hello,

 

How can we delete a term from a term store using PnP JS (v2 or v3) in a SPFx solution?


I looked at https://pnp.github.io/pnpjs/sp/taxonomy/ and found nothing,

 

Can you help?

If it is not possible, what is the alternative? Call SharePoint REST API? Call old SOAP web services from javascript?

 

Thanks

2 Replies

  • miguelisidoro Try SharePoint REST API if it works for you: 

     

    Endpoint : https://testinglala.sharepoint.com/_api/v2.1/termStore/groups/122d92ab-d7a8-479f-9888-8d4421f8218f/sets/8ed8c9ea-7052-4c1d-a4d7-b9c10bffea6f/terms/b8b3e828-cdf7-46b2-889e-f5f797a05aa3            
    Method : DELETE            
    Headers : {"Content-Type": "application/json",          
               "Authorization": "Bearer <Bearer Token>"} 

     

    References:

    1. TaxonomyClientService is still the way to go? 
    2. SharePoint Managed Metadata Services Rest API  

    Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.

    • miguelisidoro's avatar
      miguelisidoro
      Iron Contributor

      ganeshsanap thanks. I will use graph api: https://learn.microsoft.com/en-us/graph/api/termstore-term-delete?view=graph-rest-1.0&tabs=http

Resources