Export (0) Print
Expand All
0 out of 1 rated this helpful - Rate this topic

Views.GetView Method

Windows SharePoint Services 3
Returns the schema of the specified view for the specified list.

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

Parameters

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

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.

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);
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.