SPFileCollection foler = pdflibrary.RootFolder.Files;

Above code line will only give files outside folder. How can get all files inside and outside folder into SPFileCollection. What is the easiest way.


1 Answer 1


Use the following code snippet:

var query = new SPQuery();
query.Folder = pdflibrary.RootFolder;                        
query.ViewAttributes = "Scope=\"Recursive\""; 
var listItems = list.GetItems(query);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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