SPFolder.ContainingDocumentLibrary Property
Gets the GUID that identifies the document library that contains the folder, if one exists.
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online