Export (0) Print
Expand All

OrderBy Element (Query)

Last modified: April 13, 2010

Applies to: SharePoint Foundation 2010

In this article
Attributes
Child Elements
Parent Elements
Occurrences

Determines the sort order for a query. The OrderBy element contains a group of FieldRef elements.


<OrderBy  Override = "TRUE" | "FALSE"  UseIndexForOrderBy = "TRUE" | "FALSE">
  <FieldRef
    Ascending = "TRUE" | "FALSE"
    Name = "Text" />
    ...
</OrderBy>

Attribute

Description

Override

Optional Boolean.

UseIndexForOrderBy

Optional Boolean.

Minimum: 0

Maximum: 1

The order in which the fields appear is the order in which the fields are sorted. The value of the Ascending attribute in the FieldRef element determines whether to sort in ascending order.

The following example sorts the fields first in ascending order by the Newcomers field, then in descending order by Years, and finally in ascending order by Location.

<OrderBy>
  <FieldRef Name="Newcomers"/>
  <FieldRef Name="Years" Ascending="FALSE"/>
  <FieldRef Name="Location"/>
</OrderBy>
Show:
© 2014 Microsoft