SharePoint of the Day #32

If you need a collection containing both list items and list folders, pass an SPQuery to the SPList.GetItems method. On the SPQuery object, set the ViewAttributes to “Scope=RecursiveAll” to get both folders and items from a list:

SPQuery q = new SPQuery();
q.ViewAttributes = “Scope=\”RecursiveAll\”";
SPListItemCollection listItems = list.GetItems(q);

Post to Twitter Post to Delicious Delicious Post to Digg Digg This Post

Posted under Developer

This post was written by spotd on May 14, 2009

Tags:

Like this tip? Hate it? Vote here

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

What do you think if this tip?

Name (required)

Email (required)

Website

Comments

More Blog Post

Previous Post: SharePoint of the Day #31