$().SPServices.SPGetListItemsJson doesn't return TaxonomyField value

Oct 17, 2014 at 12:38 PM
Hi Marc,

i currently use $().SPServices.SPGetListItemsJson to simply retrieve values from a discussion list thread item.

The following three parameters are used to query the web service:
webUrl: "/site/001/01",
listName: "Discussion",
CAMLQuery: "<Query><Where><IsNotNull><FieldRef Name='Title' /></IsNotNull></Where></Query>"

I retrieve all expected fields and values in JSON, except the needed TaxonomyField, which uses a local site collection term store/set. Explicitly adding CAMLViewFields doesn't change the behavior.

Are there any limitations in SPGetListItemsJson regarding taxonomy fields?

kind regards

Patrick
Coordinator
Oct 17, 2014 at 2:01 PM
I don't think I've actually tested this, to be honest. What version of SharePoint?

M.
Oct 17, 2014 at 2:03 PM
Currently SharePoint 2010 SP2, but will migrated to SharePoint 2013 next year.

kind regards

Patrick
Oct 17, 2014 at 10:58 PM
A current workaround is:

var context = new SP.ClientContext.get_current();
    var web = context.get_web();
    var list = web.get_lists().getByTitle("Discussion");
    var viewXml = "<View><Query><Where><IsNotNull><FieldRef Name='Title' /></IsNotNull></Where></Query></View>";
    var query = new SP.CamlQuery();
    query.set_viewXml(viewXml);
    var items = list.getItems(query);
    context.load(items);
    context.add_requestSucceeded(onLoaded);
    context.add_requestFailed(onFailure);
    context.executeQueryAsync();
    function onLoaded() {
        var entries = [];
        var itemsCount = items.get_count();
        for (i = 0; i < itemsCount; i++) {
            var item = items.itemAt(i);alert(item.get_fieldValues());
            var entry = JSON.stringify(item.get_fieldValues());
            entries.push(taskEntry);
        }
    }
    function onFailure() {

    }
with kind regards

Patrick