1 out of 1 rated this helpful - Rate this topic

Lists.GetListAndView Method

Windows SharePoint Services 3
Returns the list and view schemas for the specified list.

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

Parameters

listName

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

viewName

A string that contains the GUID for the view. If no value is specified, returns the default view schema for the list.

Return Value

A fragment in Collaborative Application Markup Language (CAML) in the following form that contains the list and view schemas, and that can be assigned to a System.Xml.XmlNode object.
<ListAndView xmlns="http://schemas.microsoft.com/sharepoint/soap/">
   <List DocTemplateUrl=
         "" DefaultViewUrl="/Site_Name/Lists/List_Name/AllItems.aspx" 
      ID="{42FC00F1-F7EA-4ECE-9D4C-F47A95A806B2}" Title="List_Name" 
      Description="TestCustList" 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">
      <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" />
            ...
      <RegionalSettings>
         <Language>1033</Language>
         <Locale>1033</Locale>
         <AdvanceHijri>0</AdvanceHijri>
         <CalendarType>1</CalendarType>
         <Time24>False</Time24>
         <TimeZone>480</TimeZone>
         <SortOrder>2070</SortOrder>
         <Presence>True</Presence>
      </RegionalSettings>
   </List>
   <View Name="{8C25D6A5-93B4-4611-B449-55A7C3B7B41A}" Type="HTML" 
      DisplayName="View_Name" Url="Lists/List_Name/View_File.aspx" 
      BaseViewID="1">
      <Query />
      <ViewFields>
         <FieldRef Name="Attachments" />
         <FieldRef Name="LinkTitle" />
         <FieldRef Name="DateColumn" />
         ...
      </ViewFields>
      <RowLimit Paged="TRUE">100</RowLimit>
   </View>
</ListAndView>

The following code example displays the list and view schemas for a specified list on the current site.

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.GetListAndView("List_Name",
   "8c25d6a5-93b4-4611-b449-55a7c3b7b41a");

MessageBox.Show(ndLists.OuterXml);
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
RequireCheckout property

For others who may need the information and don't realize it from the XML snippet above , there is a RequireCheckout property available (True=Files must be checked out, False=Checkout not required)
i.e. where listService is a connection to the WSS Lists web service

System.Xml.XmlNode listInstance = listService.GetListAndView("yourListName", "");
listInstance.ChildNodes[0].Attributes["RequireCheckout"].Value;