Hello everyone,
I have a form which I would like to have create Calendar events if the events do not already exist in the Calendar List, and if they do already exist, update the existing items. I have, therefore two separate CAMLs - one for creating a new Item and the other for updating an existing one. I have tried both "cmd='Update'" and "cmd='Delete'", but both seem to produce the same result: it never deletes or overwrites the existing List Item - it simply creates a new one.
Below are is the Update CAML and the code I am using. Please note that in my code I am successfully finding the existing Item's Row ID and passing it to the batch - it just simply wont use it or update with it.
Please someone help me - as I am desperate to fix this issue. I am using InfoPath 2003 and SharePoint 2003.
Update CAML:
<?xml version="1.0" encoding="UTF-8" ?>
<Batch OnError="Continue">
<Method ID="1" Cmd="Update">
<Field Name="ID" />
<Field Name="Title" />
<Field Name="Description" />
<Field Name="EventDate" />
<Field Name="EndDate" />
<Field Name="ProjectManager" />
<Field Name="ProjectSponsor" />
<Field Name="DIPhase" />
<Field Name="ProjectName" />
</Method>
</Batch>
Code:
Dim DI1updatebatch
Set DI1updatebatch = XDocument.DataObjects("UpdateCAML").DOM
DI1updatebatch.selectSingleNode("/Batch/Method/Field[@Name='ID']").nodeTypedValue = DI1rowtodelete
DI1updatebatch.selectSingleNode("/Batch/Method/Field[@Name='Title']").text = DI1FieldTitle
DI1updatebatch.selectSingleNode("/Batch/Method/Field[@Name='Description']").text = Description
DI1updatebatch.selectSingleNode("/Batch/Method/Field[@Name='EventDate']").text = DI1EventDate
DI1updatebatch.selectSingleNode("/Batch/Method/Field[@Name='EndDate']").text = DI1EndDate
DI1updatebatch.selectSingleNode("/Batch/Method/Field[@Name='ProjectManager']").text = ProjectManager
DI1updatebatch.selectSingleNode("/Batch/Method/Field[@Name='ProjectSponsor']").text = ProjectSponsor
DI1updatebatch.selectSingleNode("/Batch/Method/Field[@Name='DIPhase']").text = "1"
DI1updatebatch.selectSingleNode("/Batch/Method/Field[@Name='ProjectName']").text = ProjectName
XDocument.DataAdapters("CalendarUpdate").Submit
Set DI1updatebatch = Nothing