Showing posts with label Lists. Show all posts
Showing posts with label Lists. Show all posts

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 http://company.com/Clients/_vti_bin/Lists.asmx, but I am getting the same response as if the web reference were set to the site root (i.e. http://company.com/_vti_bin/Lists.asmx).

Thanks to user in.the.dark on MSDN forums (http://forums.msdn.microsoft.com/en-US/sharepointdevelopment/thread/80be9abc-f9e0-49b6-8ebc-8f90ddbf27a2/), a workaround is to set the URL programmatically, like so:

using (com.company.Lists lists = new com.company.Lists())
{
lists.Url = "http://company.com/Clients/_vti_bin/Lists.asmx";
XmlNode listColl = lists.GetListCollection();
}

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