UpdateViewHtml Method

The UpdateViewHtml method of the Views service updates the specified view with the supplied properties and values, including the display properties of Collaborative Application Markup Language (CAML) and HTML.

Parameters

listName   A string that contains the internal name of the list.

viewName   A string that contains the GUID for the view.

viewProperties   An XML fragment that contains all the view-level properties as attributes, such as Editor, Hidden, ReadOnly, and Title.

toolbar   A Toolbar element that sets the HTML used to render the toolbar in a view and that can be assigned to a System.Xml.XmlNode object, as in the following example:

<Toolbar Type="Standard">
   <IfEqual>
      <Expr1>
         <GetVar Name="SearchString" />
      </Expr1>
      <Expr2 />
      <Then>
      .
      .
      .
</Toolbar>

viewHeader   A ViewHeader element that sets the HTML used to render the header of a view and that can be assigned to a System.Xml.XmlNode object, as in the following example:

<ViewHeader>
   <HTML>
      <![CDATA[ <TABLE width="100%" cellspacing=0 cellpadding=0 border=0> ]]>
   </HTML>
   .
   .
   .
</ViewHeader>

viewBody   A ViewBody element that sets the HTML used to render the body of a view and that can be assigned to a System.Xml.XmlNode object, as in the following example:

<ViewBody>
   <HTML>
      <![CDATA[ <TR>]]>
   </HTML>
   <Fields>
      <HTML>
         <![CDATA[ <TD Class=" ]]>
      </HTML>
      .
      .
      .
</ViewBody>

viewFooter   A ViewFooter element that sets the HTML used to render the footer of a view and that can be assigned to a System.Xml.XmlNode object, as in the following example:

<ViewFooter>
   <HTML>
      <![CDATA[ </TABLE> ]]>
   </HTML>
   <IfEqual>
   .
   .
   .
</ViewFooter>

viewEmpty   A ViewEmpty element that contains the HTML used to render the page if the query returns no items and that can be assigned to a System.Xml.XmlNode object, as in the following example:

<ViewEmpty>
   <HTML>
      <![CDATA[ <TABLE width="100%" cellspacing=0 cellpadding=0 border=0><tr><td> ]]>
   </HTML>
   .
   .
   .
</ViewEmpty>

rowLimitExceeded   A RowLimitExceeded element that specifies alternate rendering for when the specified row limit is exceeded and that can be assigned to a System.Xml.XmlNode object, as in the following example:

<RowLimitExceeded>
   <HTML><![CDATA[ <table class="ms-summarycustombody" cellpadding=0 cellspacing=0 border=0 rules=rows>
   .
   .
   .
   </td></tr></table> ]]></HTML>
</RowLimitExceeded>

query   A Query element containing the query that determines which records are returned and in what order, and that can be assigned to a System.Xml.XmlNode object. The following example performs a query for cases in which the ID field is less than 3, and displays items in the order of their titles:

<Query>
   <Where>
      <Lt>
         <FieldRef Name="ID" />
         <Value Type="Counter">3</Value>
      </Lt>
   </Where>
   <OrderBy>
      <FieldRef Name="Title" />
   </OrderBy>
</Query>

viewFields   A ViewFields element that specifies which fields to return in the query and in what order, and that can be assigned to a System.Xml.XmlNode object, as in the following example:

<ViewFields>
   <FieldRef Name="ID" />
   <FieldRef Name="Title" />
</ViewFields>

aggregations   An Aggregations element that specifies the fields to aggregate and that can be assigned to a System.Xml.XmlNode object, as in the following example:

<Aggregations Value="On">
   <FieldRef Name="Title" Type="Count">
   <FieldRef Name="Number" Type="Sum">
</Aggregations>

formats   A Formats element that defines the grid formatting for columns and that can be assigned to a System.Xml.XmlNode object, as in the following example:

<Formats>
   <FormatDef Type="RowHeight" Value="67" />
   <Format Name="Attachments">
      <FormatDef Type="ColWidth" Value="75" />
   </Format>
   <Format Name="LinkTitle">
      <FormatDef Type="WrapText" Value="1" />
      <FormatDef Type="ColWidth" Value="236" />
   </Format>
   .
   .
   .
</Formats>

rowLimit   A RowLimit element that specifies the number of items, or rows, to display on a page before paging begins and that can be assigned to a System.Xml.XmlNode object. The fragment can include the Paged attribute to specify that the view return list items in pages. The following example sets a limit of 100 items per page:

<RowLimit Paged="True">100</RowLimit>

Return Value

A CAML fragment in in the following form that contains the view schema and that can be assigned to a System.Xml.XmlNode object:

<View Name="{54992C89-4F9F-4B2E-8E5A-F55C1C70831B}" Type="HTML" DisplayName="MyView" Url="Lists/TestCustList/MyView.aspx" BaseViewID="1" xmlns="http://schemas.microsoft.com/sharepoint/soap/">
   <ViewFields>
      <FieldRef Name="Attachments" />
      <FieldRef Name="LinkTitle" />
      <FieldRef Name="ID" />
      <FieldRef Name="Created" />
   </ViewFields>
   <Query>
   .
   .
   .
   </Query>
   <ViewEmpty>
   .
   .
   .
   </ViewEmpty>
   <GroupByHeader>
   .
   .
   .
   </GroupByHeader>
   <GroupByFooter>
   .
   .
   .
   </GroupByFooter>
   <ViewHeader>
   .
   .
   .
   </ViewHeader>
   <ViewBody>
   .
   .
   .
   </ViewBody>
   <ViewFooter>
   .
   .
   .
   </ViewFooter>
   <PagedRowset>
   .
   .
   .
   </PagedRowset>
   <PagedRecurrenceRowset>
   .
   .
   .
   </PagedRecurrenceRowset>
   <RowLimit Paged="TRUE">100</RowLimit>
   <ViewBidiHeader>
   .
   .
   .
   </ViewBidiHeader>
   <Toolbar Type="Standard">
   .
   .
   .
   </Toolbar>
</View>

Remarks

To modify only the query and field definitions in a view, use the UpdateView method.

Example

The following code example modifies the View Footer region in a view, adding text and a hyperlink to the Announcements list in the current site.

This example requires that a using (C#) or Imports (Visual Basic .NET) directive be included for the System.Xml namespace.

Requirements

Platforms: Microsoft Windows Server 2003

Web Reference: http://Server_Name/[sites/][Site_Name/]_vti_bin/Views.asmx