How to Add Terms to Managed MetaData Term Store

  • 15 February 2022
  • 0 replies
  • 176 views

Userlevel 3
Badge +8

Topic

How to use the TaxonomyClientService.asmx web service to add a term to the Managed MetaData term store in a workflow.

 

Instructions

Add the 'Call Web Service' action to your workflow. Configure this action as follows:

 

URL: [siteURL]/_vti_bin/TaxonomyClientService.asmx

Username/Password: Enter credentials with permissions to the web service

Web Method: Click 'Refresh' and select the 'AddTerms' method from the dropdown menu.

Editor Mode: SOAP Builder (optional)

Web Service Input (with example values)

  • sharedServiceId (guid) - the Term Store ID. Ex: beb8be41e33149d88cc7c21b98c3490e
  • termSetId (guid) - Term Set ID. Ex: e3ac136d-32bc-4b21-80fe-d656aca5b370
  • lcid (int) - Locale ID. Ex: 1033
  • newTerms (string) - XML of new terms to add. Ex: <newTerm label="Seattle" clientId="1" parentTermId="00000000-0000-0000-0000-000000000000"></newTerm>

 

Where are these values coming from?

The first two parameters can be found in the Term Store Management Tool page. To access this page, navigate to Central Administration > Application Management > Manage Service Applications > Select [Managed Metadata] > click 'Manage' (in the ribbon)

 

The Term Store ID required for the sharedServiceId parameter can be found by clicking on the Term Store and locating the 'Unique ID'. See the screenshot below:

 

9005iE3693B3290AAB98D.png

 

Similarly, the Term Set ID required for the termSetId parameter can be found by clicking on the Term Set and locating the 'Unique ID'. See the screenshot below:

9006i472C16BE11DB4479.png

Moving on, the lcid parameter requires a Locale ID. This value will be an integer and contains information about what language the term with be added in. In the example above, 1033 is en-US, meaning English - United States. Additional codes can be found at the following link:

 

LCID (Locale ID)

https://docs.microsoft.com/en-us/openspecs/office_standards/ms-oe376/6c085406-a698-4e12-9d4d-c3b0ee3dbc4a

 

The newTerms parameter contains information about the new term that is being added, information regarding the term is passed in XML <newTerm> nodes. As you can see in the example above, there are three required attributes:

  • label - Default label for the term
  • clientId - This will always start at 1 and increment up by 1 for each additional new term.
    • For example, if you are adding 3 terms in one request, the clientId parameter would be 1 for the first term, 2 for the second term, and 3 for the third term.
  • parentTermId - The unique identifier of another term. If the term you are adding is a new term, the GUID can remain all 0's. If you are adding a term to an existing ParentTerm, you can find the ID on the Term Store Management Tool page: 

 

9007iBFC8D8E491A969BC.png

 

 

More Information

 

Microsoft's documentation regarding this operation can be found at the following link:

TaxonomyClientService.AddTerms Method

https://docs.microsoft.com/en-us/dotnet/api/microsoft.sharepoint.taxonomy.webservices.taxonomyclientservice.addterms?view=sharepoint-server

 


0 replies

Be the first to reply!

Reply