Views.GetView Method

Returns the schema of the specified view for the specified list.

Web Service: ViewsWeb Reference: http://<Site>/_vti_bin/Views.asmx


<SoapDocumentMethodAttribute("", RequestNamespace:="", ResponseNamespace:="", Use:=SoapBindingUse.Literal, ParameterStyle:=SoapParameterStyle.Wrapped)> _
Public Function GetView ( _
    listName As String, _
    viewName As String _
) As XmlNode

Dim instance As Views
Dim listName As String
Dim viewName As String
Dim returnValue As XmlNode

returnValue = instance.GetView(listName, viewName)
[SoapDocumentMethodAttribute("", RequestNamespace="", ResponseNamespace="", Use=SoapBindingUse.Literal, ParameterStyle=SoapParameterStyle.Wrapped)] 
public XmlNode GetView (
    string listName,
    string viewName


  • listName
    A string that contains the internal name of the list.
  • viewName
    A string that contains the GUID for the view. If the view name is blank, the default view is returned.

Return Value

A fragment in Introduction to Collaborative Application Markup Language (CAML) in the following form that contains the view schema and can be assigned to a System.Xml.XmlNode object.

<View Name="{EE7C652F-9CBF-433F-B376-86B0EE989A06}" 
  DefaultView="TRUE" Type="HTML" DisplayName="View_Name" 
  Url="Lists/Events/File_Name.aspx" BaseViewID="1">
        <FieldRef Name="Created"/>
        <Value Type="DateTime">2003-03-03T00:00:00Z</Value>
    <FieldRef Name="fRecurrence"/>
    <FieldRef Name="Attachments"/>
    <FieldRef Name="WorkspaceLink"/>
    <FieldRef Name="LinkTitle"/>
    <FieldRef Name="Location"/>
    <FieldRef Name="EventDate"/>
    <FieldRef Name="EndDate"/>
  <RowLimit Paged="TRUE">100</RowLimit>


The GetView method does not return the following parts of the CAML view, which contain HTML: Toolbar, ViewHeader, ViewBody, ViewFooter, PagedRowSet, and RowLimitExceeded. To return the full view definition, including these HTML sections, use the GetViewHtml method instead.


The following example uses the GetView method to display a view schema for a specified list. This example requires that a using (C#) or Imports (Microsoft Visual Basic) directive be included for the System.Xml namespace.

Dim viewService As New Web_Reference_Folder.Views()
viewService.Credentials = System.Net.CredentialCache.DefaultCredentials

Dim node As XmlNode = viewService.GetView("List_Name", "71bb8975-c59f-4218-a045-eab56b41e666 ")

Web_Reference_Folder.Views viewService = new Web_Reference_Folder.Views();
viewService.Credentials= System.Net.CredentialCache.DefaultCredentials;

XmlNode node = viewService.GetView("List_Name","71bb8975-c59f-4218-a045-eab56b41e666 ");


See Also


Views Class
Views Members
Views Web Service