That command will contain all the individual
insert commands. Continue is the most com-
mon value for the OnError attribute, but you
may also set it to Return. Figure 7 illustrates
the steps described in the following proce-
dure:
1. Drag a Script Task from the Toolbox onto
the Control Flow Design Surface.
2. Double click the Script Task to open up
the Script Task editor.
3. Click the Script tab.
4. Enter the variables from step 3, comma
separated to enable this script task to
update their values.
5. Click Design Script. The Visual Studio for
Applications window should open.
To complete the task, you'll need to add a
reference to System.Xml, SharePointServices,
and System.Web.Services by right clicking on
"References" in Solution Explorer, just as you
would in the regular Visual Studio environ-
ment. Then, add the following Imports state-
ments:
Imports System.Xml
Imports SharePointServices
Imports SharePointServices.NorthwindSync
Finally, paste in the following code:
Public Sub Main()
Try
' Create an XmlDocument
Dim xmlDoc As XmlDocument = New XmlDocument()
' Create two XML elements that look like
' <Batch OnError="Continue"></Batch>
Dim elementSuppliersBatch As XmlElement = _
ListHelper.CreateBatch(xmlDoc)
Dim listService As Lists = ListHelper.GetListsService()
ListHelper.AddDeleteAllItemsBatch( _
listService, "Suppliers", xmlDoc, elementSuppliersBatch)
' Save the results back to the SSIS variables
Dts.Variables("xmlDoc").Value = xmlDoc
Dts.Variables("elementSuppliersBatch").Value = elementSuppliersBatch
23
Putting SharePoint to Work for You, an Internet.com Developer eBook. Copyright 2008, Jupitermedia Corp.
Putting SharePoint to Work for You
[
]
Figure 7: Script Task: Initialize the variables in a new script task
by following the numbered steps.