Listing 2. Executing the Batch
Try
' retrieve the Suppliers batch
Dim elementSuppliersBatch As XmlElement = CType( _
Dts.Variables("elementSuppliersBatch").Value, XmlElement)
' get a list SharePoint service to send the batch updates to
Dim listService As SharePointServices.NorthwindSync.Lists = _
ListHelper.GetListsService()
' here's how to view the contents of your CAML statements
'Dts.Events.FireInformation( _
' 0, "!!!!!!!!!!!!!!!!", elementSuppliersBatch.InnerXml(), "", 0, False)
' executing a batch with no records in it will cause an error
If elementSuppliersBatch.ChildNodes.Count > 0 Then
' execute the results
Dim nodeResults As XmlNode = ListHelper.ExecuteLargeQuery( _
listService, "Suppliers", elementSuppliersBatch, 300)
' Here's how to view the results. In a production app you
' would want to write these out to a file.
' Dts.Events.FireInformation( _
' 0, "!!!!!!!!!!!!!!!!", nodeResults.InnerXml(), "", 0, False)
End If
Dts.TaskResult = Dts.Results.Success
Catch Ex As System.Web.Services.Protocols.SoapException
Dts.Events.FireError( _
1, Ex.TargetSite.ToString(), Ex.Detail.InnerText, "", 0)
Dts.TaskResult = Dts.Results.Failure
Catch Ex As Exception
Dts.Events.FireError( _
1, Ex.TargetSite.ToString(), Ex.Message, "", 0)
Dts.TaskResult = Dts.Results.Failure
End Try
38
Putting SharePoint to Work for You, an Internet.com Developer eBook. Copyright 2008, Jupitermedia Corp.
Putting SharePoint to Work for You
[
]