Posts

Showing posts with the label ProcessBatchData

ProcessBatchData Helper Class

There are a few ways to add multiple rows to a SharePoint list. The iterative approach (i.e.: line by line) is simple, but this pattern will fail a CAF report. The better way to get the data up is loading a batch file using the ProcessBatchData method on your trusty SPWeb object. (The official blurb on the method is  here .) The problem with this is that is requires a well formatted XML string. The easiest way to accomplish this is to writer a helper class and it is quite a life saver. Here is the class, followed by a sample of how to use the code.    public class ProcessBatchDataHelper     {         private const string ProcessBatchStartXml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";         private const string ProcessBatchRowsStartXml = "<ows:Batch OnError=\"Continue\">";         private const string ProcessBatchEndXml = @"</ows:Batch>";     ...

Error 0x80070057 when using ProcessBatchData

I was recently using the SPWeb.ProcessBatchData function (more information  here ) when the following error code reared its ugly head: 0x80070057 wtf? The  XML looked fine, but there was a sinister problem at play. The UTF declaration was in lowercase INSTEAD OF UPPERCASE. Thats three hours of my life I am never getting back. Oh well, live and learn (and share!).