How to get the folder of SPListItem?

Need to get the item's parent folder in an event/feature receiver? The code snippet below seems to be the most practical way to do that.

foreach(SPListItem item in Items)
{
    SPFile fItem= item.Web.GetFile(item.Url);
    SPFolder folder = fItem.ParentFolder;
}

1 comment: