3

I am running a sharepoint caml query where I want to check that a field on an item is equal to one of many values. I do this dynamically and may wish to check against many hundreds of values.

I found that when performing a query with 780 OR elements I got an error related to server memory. Obviously this is variable across environments, but I am looking for some guidelines suggesting a maximum query length to which I should cap.

Thanks!

  • 2
    Why do you need those 780 OR statements? Can you paste part of your CAML Query? – Sébastien Levert Mar 7 '11 at 5:22
  • I have a list with many folders (folders were required for security purposes). Each folder may have many items with in. I want to run a query such as: get all items from 600 of 800 folders. I am currently doing this by checking the FileRef field on the items with a very large nested OR caml query. If you have a better suggestion, by all means, PLEASE let me know – user2568 Mar 7 '11 at 6:21
  • 1
    can't you do a recursive search to flatten the folders content ? – Steve B Jul 21 '11 at 13:20
  • or create a view that does it and utilize that view/CAML. – Eric Alexander Jul 27 '11 at 19:41
3

Or statements are notoriously inefficient, even directly in SQL. Since the error is related to memory it seems you're hitting a hardware limit rather than any kind of built-in limit.

With this in mind, I'd recommend using a more efficient query structure, such as the <In> element to work around the issue.

| improve this answer | |
2

You might want to look at U2U CAML Builder or Stramit CAML Viewer to help build your CAML. It seems like you might want to apply a content type filter instead of looking at every folder individually.

| improve this answer | |
0

Add a RowLimit element to your query to match your environment's list view threshold. Not sure how you are using the query, but its use may be circumventing the limit.

RowLimit Element

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy