Thursday, 28 September 2017

SPServices: How to fetch SharePoint list items with all fields?



$(document).ready(getListItems);

function getListItems() {
    $().SPServices({
        //webURL: "https://domain/sites/site_collection/site",
        operation: "GetListItems",
        async: false,
        listName: "Test List",
        CAMLViewFields: "<ViewFields Properties='True' />",
        completefunc: success_getListItems
    });
}

function success_getListItems(xData, status) {
$(xData.responseXML).SPFilterNode("z:row").each(function () {
                var liHtml = "<li>" + $(this).attr("ows_Title") + "</li>";
                $("#tasksUL").append(liHtml);
            });
}

No comments:

Post a Comment