CAML update running, but not changing data (Sharepoint 2007)

2

I've been trying to create a batch update program for a MOSS site, based on the MSDN example here: http://msdn.microsoft.com/en-us/library/cc404818.aspx. Unfortunately, although the update query is running through with no errors, the data in the list is not changing.

Here is the batch command I use:

<Method ID="3767">
  <SetList>8468cf0a-7e10-439c-a9b4-4197543e7b38</SetList>
  <SetVar Name="Cmd">Save</SetVar>
  <SetVar Name="ID">3767</SetVar>
  <SetVar Name="Date_x0020_of_x0020_Birth1">1971-12-18T00:00:00Z</SetVar>
</Method>

Upon running the batch update command:

string batchReturn = web.ProcessBatchData(batch);
returns:
<Results>
  <Result ID="3767" Code="0"></Result>
</Results>

The major version number on the list item is incremented, but no changes are made to the data in field: Date_x0020_of_x0020_Birth1

I'm stumped.

More background: Date_x0020_of_x0020_Birth1 is a new field added to the default content type fo this list. It is a DateTime field. It supercedes the original Date_x0020_of_x0020_Birth field (now has a display name of "Date of Birth(Text)") which was a text field, dues o it containing values prior to 01/01/1900. The batch update is to copy dates from the text field to the new DateTime field where possible.

The only thing I can think off is that I'm using:

<SetVar Name="Cmd">Save</SetVar>

Perhaps I need the "Update" or "Save" command, so I tried this:

<Method ID="1" Cmd="Update">
  <Field Name='ID'>3767</Field>
  <Field Name="Date_x0020_of_x0020_Birth1">1971-12-18T00:00:00Z</Field>
</Method>

But that returns:

<Results>37671971-12-18T00:00:00Z<Result ID="1" Code="-2130575350">
  <ErrorText>Invalid URL Parameter

  The URL provided contains an invalid Command or Value. Please check the URL again.    
  </ErrorText>
</Result>
3767Date_x0020_of_x0020_Birth1
<Result ID="1" Code="-2147023673">
<ErrorText>The operation failed because an unexpected error occurred. (Result Code: 0x800704c7)</ErrorText>
</Result>
</Results>
sharepoint-2007
caml
asked on Stack Overflow Jan 20, 2011 by Iain • edited Jan 23, 2011 by Iain

1 Answer

1

"Update" is the right CMD, and it sounds like the update is occuring fine (updating the version number).

That just leaves the field, and it is probably the "Name" you are using.

Did you try using the urn prefix (urn:schemas-microsoft-com:office:office#Date_x0020_of_x0020_Birth1)

Can you try updating a different field, like the title. (urn:schemas-microsoft-com:office:office#Title)

If that all fails you could try using the UpdateListItems on the lists.asmx

answered on Stack Overflow Jan 21, 2011 by djeeg

User contributions licensed under CC BY-SA 3.0