Lists.GetListCollection Method
Windows SharePoint Services 3
Returns the names and GUIDs for all lists in the site.
Web Service: ListsWeb Reference: http://<Site>/_vti_bin/Lists.asmx
[SoapDocumentMethodAttribute("http://schemas.microsoft.com/sharepoint/soap/GetListCollection", RequestNamespace="http://schemas.microsoft.com/sharepoint/soap/", ResponseNamespace="http://schemas.microsoft.com/sharepoint/soap/", Use=SoapBindingUse.Literal, ParameterStyle=SoapParameterStyle.Wrapped)] public XmlNode GetListCollection ()
Return Value
A fragment in Collaborative Application Markup Language (CAML) in the following form that contains the names and GUIDs for the lists, and that can be assigned to a System.Xml.XmlNode object.<Lists xmlns="http://schemas.microsoft.com/sharepoint/soap/"> <List DocTemplateUrl= "" DefaultViewUrl="/TestWeb1/Lists/Announcements/AllItems.aspx" ID="{8A98E2E5-B377-4D0E-931B-3AC25BD09926}" Title="Announcements" Description="Use the Announcements list to post messages on the home page of your site." ImageUrl="/_layouts/images/itann.gif" Name="{8A98E2E5-B377-4D0E-931B-3AC25BD09926}" BaseType="0" ServerTemplate="104" Created="20030613 18:47:12" Modified="20030613 18:47:12" LastDeleted="20030613 18:47:12" Version="0" Direction="none" ThumbnailSize="" WebImageWidth="" WebImageHeight="" Flags="4096" ItemCount="1" AnonymousPermMask="" RootFolder="" ReadSecurity="1" WriteSecurity="1" Author="1" EventSinkAssembly="" EventSinkClass="" EventSinkData="" EmailInsertsFolder="" AllowDeletion="True" AllowMultiResponses="False" EnableAttachments="True" EnableModeration="False" EnableVersioning="False" Hidden="False" MultipleDataList="False" Ordered="False" ShowUser="True" /> <List DocTemplateUrl= "" DefaultViewUrl="/TestWeb1/Lists/Contacts/AllItems.aspx" ID="{9FFE6155-DB75-4E0C-B18C-095326112151}" Title="Contacts" Description="Use the Contacts list for information about people that your team works with." ImageUrl="/_layouts/images/itcontct.gif" Name="{9FFE6155-DB75-4E0C-B18C-095326112151}" BaseType="0" ServerTemplate="105" Created="20030613 18:47:14" Modified="20030613 18:47:14" LastDeleted="20030613 18:47:14" Version="0" Direction="none" ThumbnailSize="" WebImageWidth="" WebImageHeight="" Flags="4096" ItemCount="0" AnonymousPermMask="" RootFolder="" ReadSecurity="1" WriteSecurity="1" Author="1" EventSinkAssembly="" EventSinkClass="" EventSinkData="" EmailInsertsFolder="" AllowDeletion="True" AllowMultiResponses="False" EnableAttachments="True" EnableModeration="False" EnableVersioning="False" Hidden="False" MultipleDataList="False" Ordered="False" ShowUser="True" /> ... </Lists>
usage on subsites
It's not a problem. Just change the URL property after having created the instance of the service:
web_ref_name.Lists liservice=new web_ref_name.Lists();
liservice.URL=''http://server/subsite/sub-subsite/_vti_bin/lists.asmx'';
I changed the url to:
listservice.URL="http://server/sites/mysites/sths/_vti_bin/Lists.asmx";
And it is not working :(
- 2/12/2008
- sorokaworona
- 7/12/2011
- StephanSchwarz
This method only returns back the 'ListCollection' of the Root Site within a site collection.
Even though you may have a reference to 'http://server/subsite/sub-subsite/_vti_bin/lists.asmx' (in which GetListItems(....) etc. methods work within $0
the current context) - the results will reflect what is in the root site of the immediate sitecollection.$0
$0
Easy way to test - create a list in one of your subsites, add a reference to the webservice (lists.asmx) via the correct Url, $0
and make a call to GetListCollection.$0
$0
$0
Edit: This behoviour has been fixed and the Lists service now returns a collection of lists based on the url. Example: calling the service with the url 'http://server/subsite/sub-subsite/_vti_bin/lists.asmx' will return a the lists on the subsite 'sub-subsite' but not the lists on the root site.
- 5/13/2007
- Mick Badran - MVP
- 10/12/2010
- Zargath
Lies. All Lies. What to know what I get...
System.Xml.
XmlNode n = svc.GetListCollection();n.OuterXml == "0";
Not an error. Not an empty list. Not even a piece of XML. The number 0.
Every hour I deal with this sort of stupidity I fight the urge to hunt down a member of the dev team and kick them repeated.
- 7/6/2009
- Roger Willcocks
ServerTemplate Attribute Corresponds to Type Attribute in List Schema in CAML (?)
- 2/12/2008
- magalabastro