0

I have a list with multiple Taxonomy fields (Gender, Region, etc). I'm doing a simple form using Angular to add new items to this list. I'm using the SP Rest API to get and post the information but I can't find a way to get the list of possible values for this Managed fields in order to populate a couple of comboboxes.

Regards.

0

Here is a sample code to get multiple Taxonomy field value, loop the data.d.results and data.d.results.meta.result

<script type="text/javascript" src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.9.1.min.js"></script>
<script type="text/javascript">
TestFunc();
function TestFunc()
{

$.ajax({
    url: "http://sp/sites/dev/_api/web/lists/getByTitle('Demolist')/items?$select=meta",

    type: "GET",

    headers: {
        "Accept": "application/json;odata=verbose"
      },

    success: function (data, textStatus, jqXHR) {
    console.log(data.d.results);
    for (var i = 0; i < data.d.results.length; i++) 
    {

           for(var j=0; j<data.d.results[i].meta.results.length;j++)
          {
               console.log(data.d.results[i].meta.results[j].Label);
          }

    }

    },

    error: function (jqXHR, textStatus, errorThrown) {
        alert('error')
    }
});

}


</script>

This is the returned data.d.results, for "meta" field, it will has two row in results array: enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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