SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have just started sharepoint development using cloudshare. Now i am stuck trying to run the code below:

myListService.Url = "http://sp2010/_vti_bin/Lists.asmx";

XmlNode myListView = myListService.GetListAndView("Customers", "");

I get an exception on the second line saying something like "ListNotFound"

I have tried different web ref urls, but still not working e.g.




This is my page url -


If i try this with Tasks it works fine, but when i call 'GetListItems' it is empty (even though i have manually added some).

Anyone got any ideas?

share|improve this question

I dunno if the url that you are passing is correct.. can you try the following?

The code is getting the true url and adding the webservice at the end. It should return the correct webservice url regardless of what it is :)

string hostURL = null;
hostURL = HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority);

hostURL = hostURL + "/_vti_bin/Lists.asmx";

myListService.Url = hostURL;

XmlNode myListView = myListService.GetListAndView("Customers", ""); 

Hope it helps :)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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