I want to bulk load a few items from a list. The Caml is something like this:

   <Gt><FieldRef Name=\'ID\'/><Value Type=\'Number\'>{id}</Value></Gt>

where {id} is the id from the last element of the previous query

This works fine on my testdata. But can I be sure that the ids from that query are always incremental? In other words: Is the default order always by id?

Or do I have to add an <OrderBy>-statement?

The reason for asking is that an orderby might affect the performance which I do not want.

3 Answers 3


If you don't specify an order, there is an implied order based on ID since in SharePoint IDs increase as rows are added and there is always an index on ID even if there are no other indexes on the list. However, implied is not guaranteed. The CAML specification doesn't list a default field for sorting if none is specified.

If the order is required by the use case, add ORDERBY. You would have to test to verify but I doubt there would be any performance hit since, as you see by your test data so far, the data is generally already sorted in ID order.


Yes as default a list is sorted by ID, so if that's what you don't have to include <OrderBy>


In your query, you are using view tag. Are you querying based on a specific view? If not, then better remove it, otherwise make sure you specify which view. It is best that you use orderby as the query could change, probably the query is based on the default view. Try to change the orderby in the default view of your list/library and see what happens when you query the data.

Use Caml Query Builder for quick tests.

  • RowLimit requires a View
    – Ole Albers
    Commented Sep 26, 2018 at 13:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.