Get SPItems for a SPFolder

September 3, 2008

I have SPItems in a various sub folders in a custom list.  I have the subfolder however there didn’t seem to be any easy way of getting the SPList items for this folder.  The best/only way I’ve found to do this is by using a SPQuery as demonstrated at

Dim query As New SPQuery
query.Folder = mySubFolder
Dim list As SPList = SPContext.Current.Web.Lists(mySubFolder.ParentListId)
Dim items As  SPListItemCollection = list.GetItems(query)