Quantcast
Viewing all articles
Browse latest Browse all 6517

New Post: GetListItems Syntax with Variable Subsite/Subfolder Location

Paul, thanks for your response, and for your help on previous questions. I don't know what I was thinking putting those assignment statements outside the SPFilterNode, so thanks for setting me straight there. Having moved them inside, I'm still not getting a response, and I'm not sure where the problem is. Here's what I have now:
// The following are dynamically determined in the actual code
// These explicit values are test data
actualFilePath = "/sites/unit/subUnit";
actualListName = "Shared Documents";
actualFileName = "Shared Documents/folder/subFolder/FileName.docx";

$().SPServices({
    operation: "GetListItems",
    async: false,
    webURL: actualFilePath,
    listName: actualListName,
    CAMLQuery: "<Query><Where><Eq><FieldRef Name='FileRef' /><Value Type='Lookup'>" + actualFileName + "</Value></Eq></Where></Query>",
    CAMLViewFields: "<ViewFields><FieldRef Name='EncodedAbsUrl' /><FieldRef Name='ContentType' /><FieldRef Name='Modified' /></ViewFields>",
    CAMLQueryOptions: "<QueryOptions><IncludeMandatoryColumns>False</IncludeMandatoryColumns><ViewAttributes Scope='Recursive' /></QueryOptions>",
    completefunc: function (xData, Status) {
        $(xData.responseXML).SPFilterNode("z:row").each(function() {
            itemName = $(this).attr("ows_FileRef");
            itemMod = $(this).attr("ows_Modified");
            modDate = " (" + itemMod + ")";
        });
    }   
});

Viewing all articles
Browse latest Browse all 6517

Trending Articles