Views.GetViewHtml Method
Returns the full schema of the specified view for the specified list, including the HTML sections.
Namespace: [Views Web service]
Web service reference: http://Site/_vti_bin/Views.asmx
Syntax
'Declaration
<SoapDocumentMethodAttribute("https://schemas.microsoft.com/sharepoint/soap/GetViewHtml", RequestNamespace := "https://schemas.microsoft.com/sharepoint/soap/", _
ResponseNamespace := "https://schemas.microsoft.com/sharepoint/soap/", _
Use := SoapBindingUse.Literal, ParameterStyle := SoapParameterStyle.Wrapped)> _
Public Function GetViewHtml ( _
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.GetViewHtml(listName, _
viewName)
[SoapDocumentMethodAttribute("https://schemas.microsoft.com/sharepoint/soap/GetViewHtml", RequestNamespace = "https://schemas.microsoft.com/sharepoint/soap/",
ResponseNamespace = "https://schemas.microsoft.com/sharepoint/soap/",
Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
public XmlNode GetViewHtml(
string listName,
string viewName
)
Parameters
listName
Type: System.StringA string that contains the name of the list.
viewName
Type: System.StringA string that contains the GUID specifying the view.
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.
<GetViewHTMLResult>
<View Name="{C1036607-EC8A-11d3-82AA-0050048394B0}" DefaultView="TRUE"
Type="HTML" DisplayName="All Contacts" Url="Lists/Contacts/AllItems.htm"
BaseViewID="1" >
<ViewHeader>
...
</ViewHeader>
<ViewBody>
...
</ViewBody>
<ViewFooter>
...
</ViewFooter>
<GroupByHeader>
...
</GroupByHeader>
<GroupByFooter>
...
</GroupByFooter>
<PagedRowset>
...
</PagedRowset>
<PagedRecurrenceRowset>
...
</PagedRecurrenceRowset>
<ViewEmpty>
...
</ViewEmpty>
<ViewBidiHeader>
...
</ViewBidiHeader>
<Toolbar Type="Standard">
...
</Toolbar>
<ViewFields>
<FieldRef Name="LinkTitle" />
<FieldRef Name="FirstName" />
<FieldRef Name="Company" />
<FieldRef Name="WorkPhone" />
<FieldRef Name="HomePhone" />
<FieldRef Name="Email" />
</ViewFields>
<Query>
<OrderBy>
<FieldRef Name="Title" />
<FieldRef Name="FirstName" />
</OrderBy>
</Query>
<Aggregations>
<FieldRef Name=”Column1” Type=”Minimum”>
</Aggregations>
<RowLimit Paged="TRUE">100</RowLimit>
</View>
</GetViewHTMLResult>
Examples
The following code example uses the GetViewHtml method to display the full schema of a specified view 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.GetViewHtml("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.GetViewHtml("List_Name", "71bb8975-c59f-4218-a045-eab56b41e666");
MessageBox.Show(node.OuterXml);