I have a .NET solution which uses the SharePoint web services interface to update meta data for existing documents in a SharePoint library. However, I am finding that I need to supply different CAML update commands for my development system compared to our test environment (both environments contain several hundred test documents).
In my development environment I can use a CAML statement of the form:
<Batch OnError="Continue" PreCalc="TRUE">
<Method ID="1" Cmd="Update">
<Field Name="ID"></Field>
<Field Name="FileRef">http://SPDevServer/sites/GovTrng/OTA/Dev Tax Returns/H000111/Test Doc.docx</Field>
<Field Name="Tax_x0020_Reference">C12346</Field>
</Method>
</Batch>
However, in my test environment I have to use a CAML statement of the form:
<Batch OnError="Continue" PreCalc="TRUE">
<Method ID="1" Cmd="Update">
<Field Name="ID">1234</Field>
<Field Name="FileRef">http://SPTestServer/sites/GovTrng/OTA/Test Doc.docx</Field>
<Field Name="Tax_x0020_Reference">C12346</Field>
</Method>
</Batch>
i.e. I need to supply the SharePoint document ID in the CAML update command. If I don't supply the ID I get the error shown below:
<Results xmlns="http://schemas.microsoft.com/sharepoint/soap/">
<Result ID="1,Update">
<ErrorCode>0x80070005</ErrorCode>
<ErrorText>The operation failed because an unexpected error occurred. (Result Code: 0x80070005)</ErrorText>
</Result>
</Results>
Why the difference and how can I tell in what circumstance I need to supply the document ID?
I know I could probably get away with always supplying the ID but this involves an extra call to SharePoint which ideally I want to avoid.
Many thanks
Nigel