TaxonomyClient and AddTerms method

Jan 27, 2012 at 7:04 AM


first of all thanks for sharing this, and incredible job that is saving me a lot of time. I wanted to ask you one question. I'm trying to add a term to the managed metadata service by using the AddTerms method and I'm using this code:

    var xmlTerms = "";

    for (i = 0; i < terms.length; i++) {
        xmlTerms += "&lt;newTerm label='" + terms[i] +"' clientId='" + guid() + "' parentTermId='00000000-0000-0000-0000-000000000000'/&gt;"
        operation: "AddTerms",
        sharedServiceId: taxconfig.SspId,
        termSetId: taxconfig.TermSetId,
        lcid: 1033,
        newTerms: xmlTerms,
        completefunc: function (xData, Status) {


I'm getting "success" as the status of the operation but this is the content of the xData object:

<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="" xmlns:xsi="" xmlns:xsd="">
<AddTermsResponse xmlns="">
<AddTermsResult>&lt;?xml version="1.0" encoding="utf-16"?&gt;&lt;TermStore /&gt;

As you can see, the contents of AddTermsResult is an empty TermStore node. The termset is set to open. I can add terms to the same termset by using server side code.

Can you give me any hint on what's going on?

Thanks in advance!

May 28, 2012 at 5:16 PM

Hi David,

I am trying to get this function to work also, with different bad results. Did you ever get it to work?


Oct 3, 2013 at 6:03 AM
Did any one get it to work?
Mar 17, 2014 at 9:52 PM
Thanks David and Peter for getting me on the right track, I know this is a long time since you guys posted, but I had a hard time getting it to work so figured I will post it for everyone else.

(Other thread that led me here:

This link is what I consider the only useful documentation from Microsoft on this topic:

What you are missing is an encoded "<newTerms>" inside the "<newTerms>"

Here is a complete request that works for me:
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="" xmlns:xsd="" xmlns:xsi="">

<AddTerms xmlns="">
    <newTerms>&lt;newTerms&gt;&lt;newTerm label=&quot;Test Root&quot; clientId=&quot;1&quot; parentTermId=&quot;00000000-0000-0000-0000-000000000000&quot; &gt;&lt;/newTerm&gt;&lt;/newTerms&gt;</newTerms>

<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="" xmlns:xsi="" xmlns:xsd=""><soap:Body><AddTermsResponse xmlns=""><AddTermsResult>&lt;?xml version="1.0" encoding="utf-16"?&gt;&lt;TermStore&gt;&lt;T a9="ccbd12f6-61e1-4a01-9cf4-c9fa8685a3ca" a21="false" a61="1"&gt;&lt;LS&gt;&lt;TL a32="Test Root" a31="true" /&gt;&lt;/LS&gt;&lt;DS /&gt;&lt;TMS&gt;&lt;TM a24="48508451-17d5-4bdb-b1c9-7f096f680352" a12="Site / Location" a40="" a17="true" a67="" a45="ccbd12f6-61e1-4a01-9cf4-c9fa8685a3ca" /&gt;&lt;/TMS&gt;&lt;/T&gt;&lt;/TermStore&gt;</AddTermsResult></AddTermsResponse></soap:Body></soap:Envelope>