Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have an application in which I have added a web reference to:

http://base/m/mysite/_vti_bin/Lists.asmx

I have the following code:

MyWebRef.Lists someList = new MyWebRef.Lists();
XmlNode result = someList.GetListAndView("MyList", string.Empty);

but for it is throwing a "List does not exist..." error, and when I look at MyWebRef.URL it comes back as http://base/_vti_bin/Lists.asmx

The list in question does not exist here so the error makes sense, but I don't understand why the instance of my web reference is pointing to the base site, when the web reference I added was definately for the subsite.

What am I doing wrong here? Can anyone suggest a fix?

share|improve this question
    
did you find the issue? –  Falak Mahmood Jun 27 '12 at 9:50
    
Yes, your answer solved the problem. –  Abe Miessler Jun 27 '12 at 15:21

1 Answer 1

up vote 1 down vote accepted

/_vti_bin is a virtual directory that is used for the web services and accessible across all sites, similarly to other folders like _/layouts etc.

You can explicitly set the Url property to be from subsite, like:

someList.Url = "http://base/m/mysite/_vti_bin/Lists.asmx";    

Make sure you also authenticate your client:

someList.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;

P.S. someList is a proxy to web service

share|improve this answer

Your Answer

 
discard

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.