SharePoint Web Service: Need to fetch list in a sub-site
Alright, so I've figured out how to conn开发者_Python百科ect to a web service (.NET 2.0 style) and return some lists.
private void PrintLists()
{
// ListsService is a property that returns the Lists web service, authenticated.
XmlNode node = ListsService.GetListCollection();
foreach (XmlNode sub_node in node.ChildNodes)
{
Console.WriteLine(sub_node.Attributes["Title"].InnerText);
}
}
This returns a number of lists that indeed exist in the SharePoint instance.
The problem I have is that the list I want is deep within SharePoint. There are "sub-sites" or "sub-webs", as I understand they're called (please correct me if I'm wrong), which are the tabs at the top of the SharePoint page when viewed in a browser. In one of those tabs, there is a particular sub-section and then finally there is a number of lists, one of which I wish to retrieve.
But those lists don't show up when I fetch them with the above code, understandably because I haven't told the web service where to look for them, and that's where I'm stuck. I don't know how to specify the location of the list that I want to retrieve.
Any help greatly appreciated as always.
http://msdn.microsoft.com/en-us/library/lists%28office.12%29.aspx
Do this before the call:
ListsService.Url = "http://yourserver/sites/yoursite/_vti_bin/lists.asmx"
精彩评论