$().SPServices.SPUpdateMultipleListItems for document libraries

Sep 15, 2014 at 7:09 PM
Hi Marc,

I need a little help from you regarding the usage of $().SPServices.SPUpdateMultipleListItems.

My Issue:
I have a document library with a bunch of subfolders (ID = ID of a contract)

VmVTGBibl/ID ID = SharePoint item ID of a contract

VmVTGBibl/1
VmVTGBibl/2
VmVTGBibl/3
etc.

My files in this folder have e referenz field like VmVTGRef = ID of the contract.
After I had copied a bunch of files witch are important for the contract to the folder they don’t have a reference to the contract.
Witch I would like to show them with Alexander Bautz vLookup for Sharepoint.

I want do the following with $().SPServices.SPUpdateMultipleListItems

Update every field VmVTGRef with the contract ID (VmVTGBibl/ID) of the subfolder.

camlQuery = "<Query>" +
                          "<Where>" +
                          "<Neq><FieldRef Name='VmVTGRef'/><Value Type='Text'>" +  folderName + "</Value></Neq>" +
                          "</Where>" +
                  "</Query>";


          folderName = ID of the contract.


$().SPServices.SPUpdateMultipleListItems({
    listName: “VmVTGBibl”,
    CAMLQuery: camlQuery,
    batchCmd: "Update",
    valuepairs: [["VmVTGRef",folderName]],
    debug: true,
    completefunc: function(xData, Status) 
    {

           alert (functionName + ".Status: " + Status);                          

        if (Status != "success")
        {
           if (debug) alert (functionName + ".xData.responseXML.xml: " + xData.responseXML.xml); 
        }
    }
});
I don’t know how to update only the valuepairs with the ID of the contract = folderName.
But only those ID which are not assigned yet or assigned with a other value of VmVTGRef as the ID of the subfolder.

I need some help and I hope you can follow me. Maybe it’s simple but I can’t get it.

Rudolf
Coordinator
Sep 17, 2014 at 5:56 PM
Rudolf:

I'm not sure I understand fully, but you may need to roll your own code since you want to calculate the value of a column per folder.

SPUpdateMultipleListItems simply does a GetListItems to find all the items that match the query and then writes back to those items as specified. You could use the function as your starting point.

M.