Thursday, July 24, 2008

Accessing subsites' lists via the MOSS 2007 Lists.asmx web service

I spent a little bit of time trying to figure this one out. I'm playing with the exposed web services that MOSS 2007 provides, trying to figure out how to manipulate lists via this API. My web reference is set to, but I am getting the same response as if the web reference were set to the site root (i.e.

Thanks to user in.the.dark on MSDN forums (, a workaround is to set the URL programmatically, like so:

using ( lists = new
lists.Url = "";
XmlNode listColl = lists.GetListCollection();

listColl now contains the subsite's lists, rather than the root site's lists.


A Ranting Man said...

Adding this line that sets the URL creates a new error -

Possible SOAP version mismatch: Envelope namespace [url] was unexpected. Expecting [url].

Kiquenet said...

For me, the signature for GetListItems method is

public System.Xml.Linq.XElement GetListItems(string listName, string viewName, System.Xml.Linq.XElement query, System.Xml.Linq.XElement viewFields, string rowLimit, System.Xml.Linq.XElement queryOptions, string webID)

It use XElement, not XmlElement neither XmlNOde.

And I get the same error about it.