Share via


Query Element

The Query element defines the query for a view. This element can contain an OrderBy element, which determines the sort order, and a Where element, which provides the filter for the view.

Syntax

<Query>
</Query>
Parent Elements Child Elements
View OrderBy, Where

Example

The following example queries the Status field for cases where the value does not equal Completed or is null, returning the results according to a descending sort on the Modified field. The Where element contains an Or element to group the filters.

<Query>
  <OrderBy>
    <FieldRef Name="Modified" Ascending="FALSE"></FieldRef>
  </OrderBy>
  <Where>
    <Or>
      <Neq>
        <FieldRef Name="Status"></FieldRef>
        <Value Type="Text">Completed</Value>
      </Neq>
      <IsNull>
        <FieldRef Name="Status"></FieldRef>
      </IsNull>
    </Or>
  </Where>
</Query>

See Also

QueryInfo