My CAML Query on a large Pages library based on a folder structure takes too long (15-20 seconds), and I wonder how I could optimize this. I currently use a filter where

FileRef BeginsWith [specific path with subfolders]

Is FileRef an indexed column by default or not? Would EncodedAbsUrl be a better option than FileRef?

I realize that I would be better off if I used a Choice column and an Equals filter instead, but a folder structure still seems to be easier to understand for our end users, compared to tagging each item.

1 Answer 1


Certain things can optimize it if you haven't used:-

1) Get only those columns which you require eg if you need only Title and FileReaf column then use like the below one

query.ViewFields = string.Concat("", "");

2) Set row limit

It would be more easier if you can provide number of pages in that library and your caml query


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.