To get the count of document libraries, we can use below simple code in SSOM:
Sweet and Simple. Hope this helps.!!!
using(SPSite site = new SPSite("https://yoursiteURL"))
{
  using (SPWeb web = site.OpenWeb())
  {
    SPListCollection librarycollection = Web.GetListsOfType(SPBaseType.DocumentLibrary);
    int count  = librarycollection .Count;
  }
}
Sweet and Simple. Hope this helps.!!!
 

No comments:
Post a Comment