2 out of 3 rated this helpful Rate this topic

Lists.GetList Method

Windows SharePoint Services 3
Returns a schema for the specified list.

Web Service: ListsWeb Reference: http://<Site>/_vti_bin/Lists.asmx
[SoapDocumentMethodAttribute("http://schemas.microsoft.com/sharepoint/soap/GetList", RequestNamespace="http://schemas.microsoft.com/sharepoint/soap/", ResponseNamespace="http://schemas.microsoft.com/sharepoint/soap/", Use=SoapBindingUse.Literal, ParameterStyle=SoapParameterStyle.Wrapped)] 
public XmlNode GetList (
	string listName
)

Parameters

listName

A string that contains either the title or the GUID for the list. When querying the UserInfo table, the string contains "UserInfo".

Return Value

A fragment in Collaborative Application Markup Language (CAML) in the following form that contains the list schema and that can be assigned to a System.Xml.XmlNode object.
<List DocTemplateUrl="" DefaultViewUrl="/Site_Name/Lists/List_Name/AllItems.aspx" 
   ID="{42FC00F1-F7EA-4ECE-9D4C-F47A95A806B2}" Title="List_Name" Description="Description" 
   ImageUrl="/_layouts/images/itgen.gif" Name="{42FC00F1-F7EA-4ECE-9D4C-F47A95A806B2}" 
   BaseType="0" ServerTemplate="100" Created="20030616 18:37:44" Modified="20030618 18:26:57" 
   LastDeleted="20030616 18:37:44" Version="2" Direction="none" ThumbnailSize="" WebImageWidth="" 
   WebImageHeight="" Flags="4096" ItemCount="5" AnonymousPermMask="" 
   RootFolder="/Site_Name/Lists/List_Name" 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" 
   xmlns="http://schemas.microsoft.com/sharepoint/soap/">
   <Fields>
      <Field ColName="tp_ID" ReadOnly="TRUE" Type="Counter" Name="ID" PrimaryKey="TRUE" 
         DisplayName="ID" FromBaseType="TRUE" />
      <Field Type="Text" Name="Title" DisplayName="Title" Required="TRUE" FromBaseType="TRUE" 
         ColName="nvarchar1" />
         ...
   <Fields>
   <RegionalSettings>
      <Language>1033<Language>
      <Locale>1025<Locale>
      <CalendarType>6<CalendarType>
      <AdvanceHijri>-1</AdvanceHijri>
      <TimeZone>1</TimeZone>
      <Time24>1</Time24>
      <SortOrder>1033<SortOrder>
      <Presence Enabled=”True” />
    </RegionalSettings>
</List>

The following code example displays the schema for a specified list.

This example requires that a using (Visual C#) or Imports (Visual Basic) directive be included for the System.Xml namespace.

Web_Reference_Folder.Lists listService = new Web_Reference_Folder.Lists();
listService.Credentials= System.Net.CredentialCache.DefaultCredentials;

XmlNode ndLists = listService.GetList("List_Name");

MessageBox.Show(ndLists.OuterXml);
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
How can I display the list details
 <script  src="/Component/Script/jquery-1.6.2.min.js" type="text/javascript"></script>   // www.jquery.com
 <script  src="/Component/Script/jquery.SPServices-0.6.2.min.js" type="text/javascript"></script>   //www.codeplex.com

<script type="text/javascript">
$(document).ready(function() {
    $("#infolist").click(function() {
          var ListName = $("#List-Name").val();
          $().SPServices({
                 operation: "GetList",
                 async: false,
                 listName: "Liste association",
                 completefunc: function(xData, Status)
                 {
                      $(xData.responseXML).find("[nodeName=Field]").each(function() {
                      var listItems = "<li>" + $(this).attr("Name") + "</li>";
                      $("#DisplayHere").append(listItems);
                 });
            }
        });
    });
 });
</script>

<input id="infolist" type="button" value="info liste"/>

<ul id="DisplayHere"/>
Typos in XML
In the XML for the return value a lot of the closing tags are missing slashes.
For example:      <SortOrder>1033<SortOrder>
Getting the count of items in a SharePoint library folder

I'm working on an Info Path 2007 form that is a content type in a document library. This form has a field that represents the count of the current form in the SharePoint library specially in a certain folder.I tried the getlist function and it worked and I could get the count of items in the document library using the itemcount but I would like to get the count of items in a specific folder in this library so how can I do this?

Thanks
How can I display the list details
I was trying to display the field names of the list, and this funtion was not working.


<script type="text/javascript">
$(document).ready(function() {
    $("button#Show-List-Details").click(function() 
    {
          var ListName = $("#List-Name").val();
          $().SPServices({
                 operation: "GetList",
                 async: false,
                 listName: ListName,
                 completefunc: function(xData, Status) 
                 {

                      $(xData.responseXML).find("[nodeName=Field]").each(function() {

                      var listItems = "<li>" + $(this).attr("Name") + "</li>";
                      $("#DisplayHere").append(listItems);
                 }
          });
    }
 });
</script>
<ul id="DisplayHere"/>