Wednesday, March 15, 2017

Retrieve items from a particular folder of a list

using (SPWeb spWeb = SPContext.Current.Site.AllWebs["Reports"]) { SPList spList = spWeb.Lists.TryGetList("ManageReports"); SPQuery spQuery = new SPQuery(); //Setting the ViewAttribute to "Scope='Recursive'" //fetches all items from the list, //ie., also the items within the folders spQuery.ViewAttributes = "Scope=\"Recursive\""; SPListItemCollection items = spList.GetItems(spQuery); }

No comments:

Post a Comment