SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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)


share|improve this question

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.

share|improve this answer

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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