0

TaxonomyClientService.asmx is a SOAP service used to manage and obtain information from the Termstore in Sharepoint Online. Although is still available, is already old. Is this web service still the correct way to obtain information about SharePoint Terms?

Currently we have a project that is being developed in .Net Core 3.1 and Azure functions for Sharepoint Online, and we are using OAuth 2.0/ Azure AD to authenticate. Azure AD has application permissions to read the TermStore, and I'm producing the access token without issues, but the access token is not being accepted in TaxonomyClientService returning a 401 Unauthorized. Also, the permission has already been given admin consent in Azure AD app register.

I have checked the issuer, the audience, roles and app id, and everything seems correct.

Also, there is a list returned in the WWW-Authenticate header of the response. This list includes the tenant id, the issuers allowed, etc. and my information matches with the requested in the list, so i really don't know what else does it need to give me access.

Additionaly, i have searched about the service and i find very little info, with no details on the authorization process, so I'm wondering if the service is still the correct way to read the termstore or if there is already another way in the Sharepoint Rest API or Graph API (which i have not found anything related to the termstore).

Thanks!

1

2 Answers 2

1

It's not recommended to use soap directly. CSOM offered TermStore related class to manage and obtain information from the Termstore in Sharepoint Online.

To get terms via CSOM, you may take a reference of below blogs:

1

The rest 2.1 API supports CRUD operations on the TermStore. There is an useful write-up of accessing the terms located here: https://www.c-sharpcorner.com/blogs/sharepoint-managed-metadata-services-rest-api

To avoid this being a link-only answer, I have replicated the examples below.

TermStore groups:

To list:

Endpoint : https://testinglala.sharepoint.com/_api/v2.1/termStore/groups  
Method : GET  
Headers : {"Content-Type": "application/json",
           "Authorization": "Bearer <Bearer Token>"}

To create:

 Endpoint : https://testinglala.sharepoint.com/_api/v2.1/termStore/groups    
 Method : POST    
 Headers : {"Content-Type": "application/json",  
            "Authorization": "Bearer <Bearer Token>"}
 Body : {"name":"FromRESTAPI", "description":"Description For FromRESTAPI"} 

Term Sets:

To List:

Endpoint : https://testinglala.sharepoint.com/_api/v2.1/termStore/groups/122d92ab-    d7a8-479f-9888-8d4421f8218f/sets
Method : GET    
Headers : {"Content-Type": "application/json",  
           "Authorization": "Bearer <Bearer Token>"} 

To Create:

Endpoint : https://testinglala.sharepoint.com/_api/v2.1/termStore/groups/122d92ab-d7a8-479f-9888-8d4421f8218f/sets      
Method : POST      
Headers : {"Content-Type": "application/json",    
           "Authorization": "Bearer <Bearer Token>"}
Body : {"description": "","localizedNames": [{"name": "OperationLevel","languageTag": "en-US"}]} 

To Update:

Endpoint : https://testinglala.sharepoint.com/_api/v2.1/termStore/groups/122d92ab-d7a8-479f-9888-8d4421f8218f/sets/dbc06a0b-7f38-42dc-84a7-0b734f350303          
Method : PATCH         
Headers : {"Content-Type": "application/json",        
           "Authorization": "Bearer <Bearer Token>"}    
Body : {"description": "Added description","localizedNames": [{"name": "OperationLevelUpdated","languageTag": "en-US"}]} 

To Delete:

Endpoint : https://testinglala.sharepoint.com/_api/v2.1/termStore/groups/122d92ab-d7a8-479f-9888-8d4421f8218f/sets/dbc06a0b-7f38-42dc-84a7-0b734f350303            
Method : DELETE          
Headers : {"Content-Type": "application/json",          
           "Authorization": "Bearer <Bearer Token>"} 

Terms

To List:

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

To Create (note, isDefault must be true or it will fail):

Endpoint : https://testinglala.sharepoint.com/_api/v2.1/termStore/groups/122d92ab-d7a8-479f-9888-8d4421f8218f/sets/8ed8c9ea-7052-4c1d-a4d7-b9c10bffea6f/children        
Method : POST        
Headers : {"Content-Type": "application/json",      
           "Authorization": "Bearer <Bearer Token>"}   
Body : {"labels": [{"name": "AI","isDefault":true,"languageTag": "en-US"}],"descriptions": [{"description": "AI Innovation","languageTag": "en-US"}]} 

To Update (I haven't used this):

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 : PATCH          
Headers : {"Content-Type": "application/json",        
          "Authorization": "Bearer <Bearer Token>"}     
Body : {"labels": [{"name": "AI Updated","isDefault":true,"languageTag": "en-US"}],"descriptions": [{"description": "AI Innovation Updated","languageTag": "en-US"}]} 

To Delete:

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>"}  

Nested Terms (my minor contribution)

To List:

Endpoint : https://testinglala.sharepoint.com/_api/v2.1/termStore/groups/122d92ab-d7a8-479f-9888-8d4421f8218f/sets/8ed8c9ea-7052-4c1d-a4d7-b9c10bffea6f/terms/12345678-1234-1234-1234-123456789012/children      
Method : GET      
Headers : {"Content-Type": "application/json",    
           "Authorization": "Bearer <Bearer Token>"}

I haven't yet created, updated, or deleted a nested term. I'll update this answer if I do.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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