Use this code to get all the document library-
{
using(SPWeb rootWeb = site.OpenWeb())
{
ActionDocLibRecursive(rootWeb);
}
}
The recursive method would be as follows:
private void ActionDocLibRecursive(SPWeb web)
{
// loop through each list in the web site
foreach(SPList list in web.Lists)
{
// check if the list is a document library
if(list.BaseType == SPBaseType.DocumentLibrary)
{
// if it is, create a document library object
SPDocumentLibrary docLib = (SPDocumentLibrary)list;
// check that the document library is not a "catalog"
// (e.g. "Master Pages & Page Layouts" .. or "Web Template Gallery")
if(docLib.IsCatalog == false)
{
// perform action .. you've found a document library
// and it's not a "Catalog" !
}
}
}
// call the recursive loop back on itself
foreach(SPWeb subWeb in web.Webs)
{
// call resursive method on each sub-site of the current site
ActionDocLibRecursive(subWeb);
}
}