Wednesday, July 02, 2008

CAML sorting by file name

If you are doing a CAML query and want the results sorted by the file name (and not by title, which may be different than the file name) use the following:
<OrderBy><FieldRef Name='LinkFilenameNoMenu' /></OrderBy>

2 comments:

MOSSLover said...

For the "order by" people need to realize that they have to put it outside of the "where" statements. I fall into the trap many times by adding it inside and nothing works.

Stefano said...

Great tip....You save me! Thanks a lot!

:)