How can I write a CAML query (for javascript ecma) that filters by only pdf documents or folders in sharepoint 2010? (this is for document libraries)


2 Answers 2


Use this field in your CAML query: File_x0020_Type. Compare it to pdf as a fixed value. For folders you can try ContentTypeId eq 0x0120.


It should look something like this (don't quote me because I haven't tested this):

            <FieldRef Name="File_x0020_Type" />
            <FieldRef Name="ContentTypeId" />

I recommend downloading a program like SPCamlQueryHelper to work with this stuff, as it's pretty strict about the syntax.

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.