OrderBy element (Query)

Applies to: SharePoint 2016 | SharePoint Foundation 2013 | SharePoint Online | SharePoint Server 2013

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

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

Elements and attributes

The following sections describe attributes, child elements, and parent elements.


Attribute Description
Optional Boolean.
Optional Boolean.

Child elements

Parent elements


  • 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, next in descending order by Years, and finally in ascending order by Location.

  <FieldRef Name="Newcomers"/>
  <FieldRef Name="Years" Ascending="FALSE"/>
  <FieldRef Name="Location"/>