Share via


Views.UpdateView method

Modifies the specified view of the specified list.

Namespace:  WebSvcviews
Assembly:  STSSOAP (in STSSOAP.dll)

Syntax

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

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

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.

  • viewProperties
    Type: System.Xml.XmlNode

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

  • query
    Type: System.Xml.XmlNode

    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:

  • viewFields
    Type: System.Xml.XmlNode

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

  • aggregations
    Type: System.Xml.XmlNode

    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:

  • formats
    Type: System.Xml.XmlNode

    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:

  • rowLimit
    Type: System.Xml.XmlNode

    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:

Return value

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

<UpdateViewResult>
  <View Name="{B5C3250A-1974-49E9-9F61-180F86704434}" DefaultView="TRUE" Type="HTML" 
    DisplayName="All Contacts" Url="Lists/Contacts/AllItems.htm" BaseViewID="1" > 
    <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>
      <Where>
        <Lt>
          <FieldRef Name="DueDate"/>
          <Value Type="DateTime">Today + 1</Value>
        </Lt>
      </Where>
    </Query>
    <Aggregations>
      <FieldRef Name=”Column1” Type=”Minimum”>
    </Aggregations>
    <RowLimit Paged="TRUE">100</RowLimit>
  </View>
</UpdateViewResult>

Examples

The following code example modifies the query, row limit, and view fields in a view for a list, returning items whose values for a DateTime field and a Number field exceed specified values. 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 strQuery As String = "<Where><And><Gt>" + _
    "<FieldRef Name="Date_Field" />" + _
    "<Value Type="DateTime">2003-6-10T12:00:00Z</Value></Gt>" + _
    "<Gt><FieldRef Name="Number_Field" />" + _
    "<Value Type="Number">200</Value></Gt>" + _
    "</And></Where>" + _ 
    "<OrderBy><FieldRef Name="Title" /></OrderBy>"

Dim strRowLimit As String = "50"
Dim strViewFields As String = "<FieldRef Name="Title" />" + _
    "<FieldRef Name="Date_Field" />" + _
    "<FieldRef Name="Number_Field" />"

Dim xmlDoc = New System.Xml.XmlDocument()

Dim ndQuery As XmlNode = xmlDoc.CreateNode(XmlNodeType.Element, "Query", "")
Dim ndRowLimit As XmlNode = xmlDoc.CreateNode(XmlNodeType.Element, "RowLimit", "")
Dim ndViewFields As XmlNode = xmlDoc.CreateNode(XmlNodeType.Element, "ViewFields", "")

ndQuery.InnerXml = strQuery
ndRowLimit.InnerXml = strRowLimit
ndViewFields.InnerXml = strViewFields

Dim retNode As XmlNode = viewService.UpdateView("List_Name", _
    "9781bd25-1f68-481f-81d3-1e4f3f9216dd", Nothing, ndQuery, ndViewFields, Nothing, Nothing, ndRowLimit)
Web_Reference_Folder_Name.Views viewService = new Web_Reference_Folder_Name.Views();
viewService.Credentials= System.Net.CredentialCache.DefaultCredentials;

string strQuery = "<Where><And><Gt><FieldRef Name=\"Date_Field\" />" +
    "<Value Type=\"DateTime\">2003-6-10T12:00:00Z</Value></Gt>" +
    "<Gt><FieldRef Name=\"Number_Field\" />" +
    "<Value Type=\"Number\">200</Value></Gt></And></Where>" +
    "<OrderBy><FieldRef Name=\"Title\" /></OrderBy>";

string strRowLimit = "50";

string strViewFields = "<FieldRef Name=\"Title\" />" +
   "<FieldRef Name=\"Date_Field\" />" + 
   "<FieldRef Name=\"Number_Field\" />";

XmlDocument xmlDoc = new System.Xml.XmlDocument();

XmlNode ndQuery = xmlDoc.CreateNode(XmlNodeType.Element,"Query","");
XmlNode ndRowLimit = xmlDoc.CreateNode(XmlNodeType.Element,"RowLimit","");
XmlNode ndViewFields = xmlDoc.CreateNode(XmlNodeType.Element,"ViewFields","");

ndQuery.InnerXml = strQuery;
ndRowLimit.InnerXml = strRowLimit;
ndViewFields.InnerXml = strViewFields;

XmlNode retNode = viewService.UpdateView("List_Name",
    "9781bd25-1f68-481f-81d3-1e4f3f9216dd", null, ndQuery, ndViewFields, 
    null, null, ndRowLimit);

See also

Reference

Views class

Views members

WebSvcviews namespace