Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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)

Thanks.

share|improve this question

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.

share|improve this answer

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

<Where>
    <Or>
        <Eq>
            <FieldRef Name="File_x0020_Type" />
            <ValueType="Text">pdf</ValueType>
        </Eq>
        <Eq>
            <FieldRef Name="ContentTypeId" />
            <ValueType="Text">0x0120</ValueType>
        </Eq>
    </Or>
</Where>

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

 
discard

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.