Quantcast
Channel: jQuery Library for SharePoint Web Services
Viewing all articles
Browse latest Browse all 6517

New Post: RestoreVersion does not seem to work

$
0
0
Try as I might, I have not successfully been able to get the RestoreVersion to work. My GetListItems works perfectly, and returns everyhting as expected, it just does not seem to pass the info to the RestoreVersion (I do have the proper information on the document name with it's relative path, and the version wholenumber). I have tried using the RestoreVersion from within my GetListItems complete function and also by calling it from within the complete function, but niether end up doing anything after the rest of my complete function works as expected, and cycles through all items in my called list(as I can verify with my alerts), any insight would be greatful?
when It does try to pass access the other service I did get an error showing in the Explorer dev box, saying the following:

Object expected jquery.SPServices.js, line 1206 character 6
which was this line: opt.completefunc(cachedXML, status); // When the call is complete, do this
//----------------------Function to restore document first version
function RestoreOriginalVersion(){
var LibName=$("#Library").val(); //these values come from input boxes
var viewGUID=$("#vGUID").val(); //these values come from input boxes
var docVersion=$("#dVersion").val(); //these values come from input boxes
alert("Library: "+LibName);
alert("GUID: "+viewGUID);
alert("Version: "+docVersion);
    $().SPServices({
        operation: "GetListItems",
        webURL: "http://johnsandbox.moss.bns",
        async: false,
        listName: LibName,
        viewName: viewGUID,
        CAMLViewFields: "<ViewFields><FieldRef Name='BaseName' /><FieldRef Name='_UIVersionString' /></ViewFields>",
        CAMLQueryOptions: "<QueryOptions><ViewAttributes Scope='Recursive'/></QueryOptions>",
        cacheXML: true,
        completefunc: function (xData, Status) {
                                  $(xData.responseXML).SPFilterNode("z:row").each(function() { 
               var docName = $(this).attr("ows_BaseName");
               var docCurrentVersion = $(this).attr("ows__UIVersionString");
                                       RelativeDocName = ("\/"+LibName+"\/"+docName);
                                       alert ("RelativeDocName:"+RelativeDocName);
               //DoRestore(RelativeDocName,docVersion);
                                      alert("Document: "+ docName + "  Current Version: " + docCurrentVersion);
            $().SPServices({
                    operation: "RestoreVersion",
                    fileName:RelativeDocName,
                    fileVersion:docVersion
            }); //------ end of RestoreVersion SPServices function
           }); //---------closing of Data response function
        } //----------closing of complete function
     }); //------ end of capturing Client folder data and closing of SPServices function
} //----end of RestoreOriginalVersion

Viewing all articles
Browse latest Browse all 6517

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>