Back in V2.0 we had a Web Service that did this sort of stuff for us, now in V3.0
it’s delivered straight from the Object Model.
Essentially:
- We create a batch of XML which could have ‘adds, updates + deletes’ in there.
- We call the web.ProcessBatchData(xml) method, handing to it our wishes.
This technique is fast, and CAML based 🙁
So if you need to add 100 items to the list – this would be a way to do it. (I’ve
got to check whether this technique fires event handlers on the lists or whether it’s
a ‘back door’ thing)
Note: in the snippet below, the fields are referenced via their namespace#<name>
– you can get the field’s details by saving your list ‘As a template’,
downloading the *.stp file, renaming to *.stp.cab, opening it and looking into the
*.xml file there.
– you could also call the lists.asmx webservice (..\_vti_bin\lists.asmx)
and calling the GetListCollection(); method to see a chunk of describing
XML.
1: "<ows:Batch OnError=\"Return\">" +
2: "<Method ID=\"A1\"><SetList>" + myGuid + "</SetList>" +
3: "<SetVar Name=\"ID\">New</SetVar>" +
4: "<SetVar Name=\"Cmd\">Save</SetVar>" +
5: "<SetVar Name=" +
6: "\"urn:schemas-microsoft-com:office:office#Title\">" +
7: "New Manager</SetVar>" +
8: "<SetVar Name=" +
9: "\"urn:schemas-microsoft-com:office:office#Body\">" +
10: "Congratulations to Mary for her promotion!</SetVar>" +
11: "<SetVar Name=" +
12: "\"urn:schemas-microsoft-com:office:office#Expires\">" +
13: "2003-09-14T00:00:00Z</SetVar>" +
14: "</Method>"
.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, “Courier New”, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }
Here’s a small MSDN article on it – http://msdn.microsoft.com/en-us/library/cc404818.aspx
Cheers,
Mick.