XML • Respond to Error Codes

Listing 4. Sending a CAML Batch update document returns a SOAP response message that confirms the modified values and an ErrorCode element value of 0 for a successful update. Inserts return only the ErrorCode value. You must test the response document for non-zero error codes to display a client-side error message, invoke code to handle the error, or both.

<Results xmlns="http://schemas.microsoft.com/ 
   sharepoint/soap/">
   <Result ID="Items1,Update">
      <ErrorCode>0</ErrorCode>
      <z:row ows_ID="1" ows_Modified=
         "2003-10-02 13:42:19" 
         ows_Created="2003-03-21 12:25:11" 
         ows_Author="1;#OAKLEAF\administrator" 
         ows_Editor="1;#OAKLEAF\administrator" 
         ows_owshiddenversion="16" 
         ows_Attachments="0" 
         ows__ModerationStatus="0" 
         ows_SelectTitle="1" 
         ows_Order="100.000000000000" 
         ows_GUID="{BB0EE4D1-B3D2-4A51-BE7B-
            F8603F772492}" 
         ows_CustomerID="ALFKI" 
         ows_CompanyName="Alfreds Futterkiste" 
         ows_ContactName="Maria Anders" 
         ows_ContactTitle="Sales Representative" 
         ows_Address="Obere Str. 57" 
         ows_City="Berlin" 
         ows_PostalCode="12209" 
         ows_Country="Germany" 
         ows_Phone="030-0074321" 
         ows_Fax="030-0076545" 
         xmlns:z="#RowsetSchema" />
   </Result>
   <Result ID="Items2,Delete">
      <ErrorCode>0</ErrorCode>
   </Result>
</Results>