1

I have a document library list. I created folders in that list and uploaded some files to those sub folders. How to get all these files which are in sub-folders in that document library list using SPQuery?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Abhimanyu
  • 413
  • 2
  • 13
  • 34

1 Answers1

5

If you want to query all folders and sub folders of a list or document library, you have to define extra query options. If you are working with the object model you have to set the ViewAttributes property of the SPQuery object as follows:

qry.ViewAttributes = "Scope='Recursive'";

  • i am having another doubt regarding this. If i am using the same query for discussion board list, i am getting only the replies, not able to get the listitems which shows the discussion subject. how to get all items in the discussion board list using spquery? – Abhimanyu Nov 18 '10 at 05:57
  • Inplace of Recursive use "RecursiveAll" – Ashutosh Singh-MVP SharePoint Nov 18 '10 at 06:12