Search code examples
sharepointcaml

CAML OrderBy onlt works for certain fields


So, this OrderBy works

<Query> <OrderBy> <FieldRef Name="Title" Ascending="True"/> </OrderBy> </Query>

and this one doesn't

<Query> <OrderBy> <FieldRef Name="SortOrder" Ascending="True"/> </OrderBy> </Query>

I'm at a loss. Both are fields in my SharePoint List, SortOrder was a "Number" but I changed it to a "Single Line of Text" (same as Title).

Note: If I remove the tag NO OrderBy works.


Solution

  • Well, it turns out that this is an "Internal Name" issue. The creator of the list originally named the field "Sort Order" then changed it to "SortOrder". So the internal name is "Sort_x0020_Order".

    Duh.

    Thanks everyone for your input.