6

I am trying get Data of a list using GetListItems Method of Lists.asmx Here is my code:

XmlDocument objXMLDocument = null;

NetworkCredential credentials = new NetworkCredential("user", "pass", "domain");                

XmlNode resultXml = null;

try
{
    XElement result = null;
    string strResult = "<Result>";
    ListService.Lists objLists = new ListService.Lists();
    objLists.Url = "http://domain:port/_vti_bin/Lists.asmx";
    objLists.Credentials = credentials;
    objLists.proxy=new WebProxy();
    objXMLDocument = new XmlDocument();
    objXMLDocument.LoadXml("<QueryOptions><IncludeMandatoryColumns>FALSE</IncludeMandatoryColumns><Folder>" + "ListName" + "</Folder><ViewAttributes Scope=\"RecursiveAll\" /></QueryOptions>");
    XmlNode objQueryOptions = objXMLDocument.DocumentElement;
    resultXml = objLists.GetListItems("ListName", null, null, null, "100", objQueryOptions, null);
    XElement xresult = GetXElement(resultXml);
    XElement objXElement = xresult.Element(XName.Get("data", "urn:schemas-microsoft-com:rowset"));
    IEnumerable<XElement> objXElementList = (objXElement.Descendants(XName.Get("row", "#RowsetSchema")));

    strResult = strResult + "</Result>";
    result = XElement.Parse(strResult);
    return result;
}
catch (Exception ex) { return null; }

But it throws a Microsoft.sharepoint.soapexception and when I checked for details I got these errors:

List does not exist. The page you selected contains a list that does not exist. It may have been deleted by another user. 0x82000006

Error XML

<errorstring xmlns="http://schemas.microsoft.com/sharepoint/soap/">
    List does not exist.
    The page you selected contains a list that does not exist.  It may have been deleted by another user.
</errorstring>
<errorcode xmlns="http://schemas.microsoft.com/sharepoint/soap/">0x82000006</errorcode>

Sharepoint server we are using is not in our network, it is in our clients network and we use VPN for development.

I feel like the error is can be due to proxy. In browser when i added the proxy provided by client I was able to access internet but not the sharepoint site, than I selected automatically detect proxy and site appeared.

Also i find this link with same error but not able to understand what is suggested solution is.http://www.sharepoint-answers.com/microsoft/SharePoint-Development/29848065/getlist-wss-list-does-not-exist.aspx

Please suggest what can i do. or is it feasible?

3
  • What do you specify as ListName? It should be the GUID of the list. And I'd suggest removing the <Folder> element from QueryOptions Commented Mar 29, 2012 at 13:03
  • If it was the proxy you would probably get a 407 error. Since you're getting data back from the web services, you can connect OK.
    – Kit Menke
    Commented Mar 29, 2012 at 13:25
  • How check for details for a Microsoft.sharepoint.soapexception and Microsoft.SharePoint.SoapServer.SoapServerException ?
    – Kiquenet
    Commented Mar 16, 2015 at 10:44

1 Answer 1

5

Does the list exists in the root of the site collection or in a sub site?

If the list is in the root than you can call it with: http://yourserver:port/_vti_bin/Lists.asmx

If the list you request is on a subsite you need to call the web service like this http://yourserver:port/SUBSITE/_vti_bin/Lists.asmx

4
  • +1 this is what my guess was too.. objLists.Url needs to reference the actual site where the list exists
    – Kit Menke
    Commented Mar 29, 2012 at 13:27
  • We are having a similar issue. A list with about 1200 items shows only 31 first items in a datasheet view with no Item Limit or Filter configured. ListData.svc renders all items, while Lists.asmx consistently limits to 31 and would not let you query for ID > 31 giving the same error as above. Commented Feb 22, 2013 at 9:01
  • As it seems, the problem arose after DPM restore of the list. Commented Feb 22, 2013 at 10:02
  • We had to do a delete/restore of the broken lists using a mix of Content Deployment Wizard to keep the GUIDs and web service based tools to restore the lists. Commented Feb 27, 2013 at 19:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.