title: How to Count number of Subsites in a SharePoint Site using CSOM in .NET?
body: <p>I want to count number of subsites, groups, list available in a single Site in sharepoint and display it in a List. How to do it in .NET using CSOM. I've tried like this but this is not working.</p>
  
  <pre><code> Tenant tenant = new Tenant(ctx);
                  //SiteProperties sites = tenant.GetSitePropertiesByUrl("https://developer19.sharepoint.com/sites/codesite",true);
                  var sites = tenant.GetSiteProperties(0, true);
                  sites.Context.Load(sites);
                  sites.Context.ExecuteQuery();
                  foreach( var siteProp in sites)
                  {
                      Console.WriteLine("Site Collection '{0}' has '{1}' subwebs", siteProp.Url, siteProp.WebsCount);
                  }
  </code></pre>