Views.GetView Method

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

Namespace:  [Views Web service]
Web service reference: http://Site/_vti_bin/Views.asmx

Syntax

'Declaration
<SoapDocumentMethodAttribute("https://schemas.microsoft.com/sharepoint/soap/GetView", RequestNamespace := "https://schemas.microsoft.com/sharepoint/soap/",  _
    ResponseNamespace := "https://schemas.microsoft.com/sharepoint/soap/",  _
    Use := SoapBindingUse.Literal, ParameterStyle := SoapParameterStyle.Wrapped)> _
Public Function GetView ( _
    listName As String, _
    viewName As String _
) As XmlNode
'Usage
Dim instance As Views
Dim listName As String
Dim viewName As String
Dim returnValue As XmlNode

returnValue = instance.GetView(listName, _
    viewName)
[SoapDocumentMethodAttribute("https://schemas.microsoft.com/sharepoint/soap/GetView", RequestNamespace = "https://schemas.microsoft.com/sharepoint/soap/", 
    ResponseNamespace = "https://schemas.microsoft.com/sharepoint/soap/", 
    Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
public XmlNode GetView(
    string listName,
    string viewName
)

Parameters

  • listName
    Type: System.String

    A string that contains the internal name of the list.

  • viewName
    Type: System.String

    A string that contains the GUID for the view. If the view name is blank, the default view is returned.

Return Value

Type: System.Xml.XmlNode
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">
  <Query>
    <Where>
      <Leq>
        <FieldRef Name="Created"/>
        <Value Type="DateTime">2003-03-03T00:00:00Z</Value>
      </Leq>
    </Where>
  </Query>
  <ViewFields>
    <FieldRef Name="fRecurrence"/>
    <FieldRef Name="Attachments"/>
    <FieldRef Name="WorkspaceLink"/>
    <FieldRef Name="LinkTitle"/>
    <FieldRef Name="Location"/>
    <FieldRef Name="EventDate"/>
    <FieldRef Name="EndDate"/>
  </ViewFields>
  <RowLimit Paged="TRUE">100</RowLimit>
</View>

Remarks

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.

Examples

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 ")

MessageBox.Show(node.OuterXml)
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 ");

MessageBox.Show(node.OuterXml);

See Also

Reference

Views Class

Views Members

Views Web Service