2013-04-16 38 views
4

我正在爲Microsoft SharePoint寫一個iOS客戶端。我的目標是更新列表項的日期時間字段並獲取有關錯誤的詳細信息。我有一個日期時間字段與自定義服務器端驗證。如何從UpdateListItems SOAP響應中獲取錯誤詳細信息?

這裏是/_vti_bin/Lists.asmx一個請求:

<?xml version="1.0" encoding="utf-8"?> 
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> 
    <soap:Body> 
    <UpdateListItems xmlns="http://schemas.microsoft.com/sharepoint/soap/"> 
     <listName>{405FFE91-946E-4B2F-861E-DDB24F1629F2}</listName> 
     <updates> 
     <Batch OnError="Continue" ListVersion="1"> 
      <Method ID="1" Cmd="Update"> 
      <Field Name="ID">1</Field> 
      <Field Name="DateTime_x0020_E">2000-08-08 07:00:00 +0000</Field> 
      </Method> 
     </Batch> 
     </updates> 
    </UpdateListItems> 
    </soap:Body> 
</soap:Envelope> 

這裏是一個響應:

?xml version="1.0" encoding="utf-8"?> 
<soap:Envelope 
    xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 
    <soap:Body> 
     <UpdateListItemsResponse 
      xmlns="http://schemas.microsoft.com/sharepoint/soap/"> 
      <UpdateListItemsResult> 
       <Results> 
        <Result ID="1,Update"> 
         <ErrorCode>0x8102001c</ErrorCode> 
         <ErrorText>Invalid date/time value. 

A date/time field contains invalid data. Please check the value and try again.</ErrorText> 
         <z:row ows_ContentTypeId="0x0100D3AA6E2413CF1645A9101D3421B797AE" ows_Title="test of time" ows_DateTi... skipped... 

該回復不說這個領域的有效範圍內任何東西。然而,當我嘗試設置在SharePoint站點無效的日期,我得到正確的錯誤:

SharePoint provides details on error

問:如何使用SharePoint SOAP服務得到錯誤的詳細信息?

回答

1

我發現我的錯誤在哪裏。該字段僅爲日期,因此可能SharePoint不接受值爲2000-08-08 07:00:00 +0000。當我只發送日期:

<Field Name="DateTime_x0020_E">1995-08-08</Field> 

獲得正確的錯誤文本:

<Result ID="1,Update"> 
    <ErrorCode>0x810200c5</ErrorCode> 
    <ErrorText>[DateTime E] - [Date should be after July 1, 2007]</ErrorText> 
    ... 
</Result> 
相關問題