Quantcast
Viewing all articles
Browse latest Browse all 6517

New Post: GetListItems No Document Records Returned

Hi All,

I'm trying to get the document records from a document library. The problem is, only the doc set records (folders) are returned. Here's my code:
function getDocItems(srcUrl,listName)
{ 
    var itemValue = 0;
    var CAMLfields = "<ViewFields><FieldRef Name='ID' /><FieldRef Name='Title' /><FieldRef Name='ContentType' /></ViewFields>";
    jQuery().SPServices({
        webURL: srcUrl,
        operation: "GetListItems",
        async: false,
        listName: listName,
        CAMLRowLimit: 0,
        CAMLViewFields: CAMLfields,
        completefunc: function(xData, Status) {
            var strError = $(xData.responseXML).SPFilterNode('ErrorText').text();
            if(strError !== "") {
                console.log("Error updating: " + $(xData.responseXML).SPFilterNode('z:row').attr("ows_PBCOrig") + " " + strError + "");  
            } else {
                  jQuery(xData.responseXML).SPFilterNode("z:row").each(function() {
                      console.log("Id = " + jQuery(this).attr("ows_ID") + ", Title = " + jQuery(this).attr("ows_Title") + ", ContentType = " + jQuery(this).attr("ows_ContentType"));
                  }); //jQuery(xData ...
        } //if(strError ...
        } //completefunc ...
    }); //SPServices
    return itemValue;
 } // function
Here's something like what I see in the console:
LOG: Id = 12622, Title = My_Title-05-06-2014_15-54_PM, ContentType = Doc Set Type A
LOG: Id = 12610, Title = My_Title-05-06-2014_15-51_PM, ContentType = Doc Set Type B
LOG: Id = 12598, Title = My_Title-05-06-2014_15-50_PM, ContentType = Doc Set Type B

There are many documents for each of these doc sets in the library. What am I doing wrong?

Thanks in advance for any assistance!

Tim from Boston

Viewing all articles
Browse latest Browse all 6517

Trending Articles