Determine if SPListItem belongs to a document library
So you have an instance of a SPListItem and want to know whether this item belongs to a Document Library or if it came from a list (such as an Event Calender, Survey, or Custom List). A quick way to distinguish a document library item is to access the ParentList property of the SPListItem class and examine the BaseType. In code,
SPListItem item = GetItemFromSomeWhere();
if (item.ParentList.BaseType == SPBaseType.DocumentLibrary)
{
// This item is from a document library – it probably contains a file.
}
