I'm looking to build a list of files that have recently been modified in my SharePoint Online library. I am using SPServices to query my SharePoint Library.

Here is my code:

var fieldsToRead ="<ViewFields></ViewFields>";
var query = "<Query><Where><Geq><FieldRef Name='Modified' /><Value Type=\"Date\">"+ $('#in_FromDate').val() +"</Value></Geq></Where></Query>";

    operation: "GetListItems",
    async: false,
    webURL: $().SPServices.SPGetCurrentSite(),
    listName: "Documents",
    CAMLViewFields: fieldsToRead,
    CAMLQuery: query,
    completefunc: function (xData, Status) {
        $(xData.responseXML).SPFilterNode("z:row").each(function () {
            var dtModified = $(this).attr("ows_Modified").split(";#")[1]; 
            var LinkToDoc = $(this).attr("ows_FileRef").split(";#")[1];
            var Type = $(this).attr("ows_FSObjType").split(";#")[1];    //  0 = File | 1 = Folder

            //Process Result

This works, but only for the Root of my Document Library.

Can I adjust my query or code to show all documents/folders that have been modified since the supplied date? (in_FromDate in the example above.)



CAMLQueryOptions: "<QueryOptions><ViewAttributes Scope='RecursiveAll'  /></QueryOptions>",

to your SPServices code.

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.