SharePoint CAML Query limitation

Satish Kumar 1 Reputation point
2020-12-07T05:07:38.133+00:00

Hi All,

I am trying to run SPQuery against SharePoint list which has more than 165 OR clauses, which is not nested. I get the following error - .Value does not fall within the expected range.

However query seems to be working fine when the number of OR clauses is less than 156.

Is there any limitation for number for OR / AND which we can provide in SPQuery.Query? Or is it also bound to any character limit?

Any thoughts or suggestions will be helpful.

SharePoint Server Development
SharePoint Server Development
SharePoint Server: A family of Microsoft on-premises document management and storage systems.Development: The process of researching, productizing, and refining new or existing technologies.
1,569 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Jerryzy 10,561 Reputation points
    2020-12-08T08:15:46.717+00:00

    Hi @Satish Kumar ,

    Caml Query will have 160 Or/And clauses limitation:

    Sharepoint Webpart CAML and more than 160 clauses

    What is the limit of nested OR's in a CAML Query?

    I suggest you can reduce the Or clauses in CAML due to the limitation.


    If an Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.