Get SPItems for a SPFolder

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 winsmarts.com.

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)

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: