none
Error when calling web service - UpdateListItems

    Question

  • Hi,

    I try to use web service http://shkvm19e/_vti_bin/Lists.asmx from InfoPath
    as follow:

    Lists.Lists listService = new Lists.Lists();
    
    listService.Credentials =
    new NetworkCredential(
    ConfigurationManager.AppSettings["AppUserLogin"],
    ConfigurationManager.AppSettings["AppUserPwd"],
    ConfigurationManager.AppSettings["AppUserDomain"]);
    
    listService.PreAuthenticate = true;
    
    string strBatch =
    + "<Field Name='ID'>2</Field>"
    + "<Field Name='Title'>New Title</Field></Method>";
    
    
    XmlDocument xmlDoc = new System.Xml.XmlDocument();
    System.Xml.XmlElement elBatch = xmlDoc.CreateElement("Batch");
    
    elBatch.SetAttribute("OnError", "Continue");
    elBatch.SetAttribute("ViewName", "{621AD0C9-57A2-40B9-9620-098AD800FD3A}");
    
    elBatch.InnerXml = strBatch;
    
    XmlNode ndReturn =
    listService.UpdateListItems("{901737da-409b-4a68-9eef-e5c3c06fcb2c}",
    elBatch);
    

    Unfortunately, the result is

    <Results xmlns="http://schemas.microsoft.com/sharepoint/soap/">
     <Result ID="1,Update"><ErrorCode>0x81020026</ErrorCode><ErrorText>The list that is
    referenced here no longer exists.</ErrorText>........</Results>
    

    But, I'm able to get the XML result by calling "GetList" function:

    XmlNode ndReturn =
    listService.GetList("{901737da-409b-4a68-9eef-e5c3c06fcb2c}");
    



    Can anybody know why I got "The list that is referenced here no longer
    exists." from "UpdateListLists" functions?

     

    It's the same problem reported here http://www.eggheadcafe.com/software/aspnet/30130759/error-when-calling-web-service--updatelistitems.aspx without any answer.

    Wednesday, March 23, 2011 7:35 PM

All replies

  • Hi,

    It seems like you are not specifying a command i.e. update command in the caml query.

    Try using below code.

    string strBatch = "<Method ID='1' Cmd='Update'><Field Name='ID'>2</Field><Field Name='Title'>New Title</Field></Method>";
    

     Hope this helps.
    My Blogs: http://www.sunilyadav.net Follow Me : http://www.twitter.com/yadavsunil
    Thursday, March 24, 2011 6:43 AM
  • Actually i have a slight diferent code than that above, and in mine it generates the XML as this:

    <Batch OnError="Continue" ListVersion="1">
      <Method ID="1" Cmd="New">
       <Field Name='ID'>New</Field>
       <Field Name="Title">Value</Field>
    ...
      </Method>
    ...
    </Batch>
    

    And it results in the same error. What I concluded is that there is a bug. Because if i use the same code on a different list it works perfecly. It only returns this error on a BDC populated list. I took care to ensure that every operation was implemented on that data source.

    It works on the front end to insert/delete data on that list. But only in the webservice it keeps getting this errors.

    Thursday, March 24, 2011 11:51 AM