2012-10-10 29 views
1

我已經使用webservices來更新Sharepoint列表。我正在使用網絡憑證訪問Remort服務器。批量更新(錯誤代碼0x81020016)

mylist.Credentials = new NetworkCredential(_username, _password, _domain); 

這裏是我的innerXml代碼:

 StringBuilder innerXml = new StringBuilder(); 
       innerXml.AppendFormat("<Method ID='1' Cmd='Update'>" + 
       "<Field Name='ID'>" + id + "</Field>" + 
       "<Field Name='Title'>" + title + "</Field>" + 
       "<Field Name='CostCTRShortText'>" + CostCTRShortText + "</Field>" + 
       "<Field Name='ActTyp'>" + ActTyp + "</Field>" + 
       "<Field Name='Employee'>" + Employee + "</Field>" + 
       "<Field Name='Price'>" + Price + "</Field>" + 
       "<Field Name='ITECCategory'>" + ITECCategory + "</Field>" + 
       "<Field Name='ServicePrice'>" + ServicePrice + "</Field>" 
      ); 

     innerXml.AppendLine("</Method>"); 

不幸的是我在歌廳的錯誤時更新:

<Result ID="1,Update" xmlns="http://schemas.microsoft.com/sharepoint/soap/"><ErrorCode>0x81020016</ErrorCode><ErrorText>Item does not exist 

The page you selected contains an item that does not exist. It may have been deleted by another user.</ErrorText></Result> 

當我試着去更新在遠程服務器列表項這是隻發生。按照預期,相同的代碼將工作並更新本地站點中的列表項。

請幫幫我。

+0

錯誤消息告訴你你正嘗試更新一個不存在的列表項。您是否仔細檢查了您所引用的ID是否確實存在於遠程服務器的列表中? – CBono

回答

0

我發現了這個問題。這裏ID正在發揮重要的作用。確保您的ID字段檢索正確的值。在我的情況下,我的本地列表從ID = 1開始,但生產服務器列表沒有ID = 1的行。

您可以簡單地從您的SharePoint列表中查看此ID列。並檢查值。