views:

161

answers:

1

Hi,

I'm building a windows application that search items from sharepoint document libraries, using the built in sharepoint web services.
I can query all documents from a document library.

but my problem is How get all folders in all sub folders from a document library?
i want to get the list of all the folder in a document library, not only in the first level.

below is the query i'm using:

<Where>
 <And>
  <Eq>
   <FieldRef Name="FSObjType" /> 
   <Value Type="LookUp">1</Value> 
  </Eq>
 </And>
</Where>

this query returns all the folders in a document library but in the first level, i can't get the subfolders.

So i tried to add to the query

<QueryOptions>
  <ViewAttributes Scope='Recursive' />
</QueryOptions>

and the result of this query is null.

Any help is appreciated.

A: 

Try this:

<Where>
 <And>
  <Eq>
   <FieldRef Name='FSObjType' LookupId='TRUE' /> 
   <Value Type='Lookup'>1</Value> 
  </Eq>
 </And>
</Where>
<QueryOptions>
  <ViewAttributes Scope='RecursiveAll' /> //Subfolders recursively
</QueryOptions>

You may test your queries if they are valid or not with CAML Query builder.

I haven't tested query i pasted....

Janis Veinbergs