CAML queries: how to filter folders from result set?

Marian Polacek picture Marian Polacek · Dec 2, 2008 · Viewed 50.2k times · Source

I'm using caml query to select all documents which were modified or added by user. Query runs recursively on all subsites of specified site collection.

Now problem is I can't get rid of folders which are also part of result set. For now I'm filtering them from result datatable. But I'm wondering: Is it possible to filter out folders from result set just by using caml?

Answer

Johan Leino picture Johan Leino · Sep 3, 2009

This CAML actually does the trick:

<Where>
    <Eq>
        <FieldRef Name='FSObjType' />
        <Value Type='Integer'>0</Value>
    </Eq>
</Where>

that will not give you any folders.