public static Web getSubWebs(Web orootweb ,string path)
{
Web orWebsite = null;
try
{
ClientContext clientContext = new ClientContext( path+orootweb.ServerRelativeUrl );
Web oWebsite = clientContext.Web;
clientContext.Load(oWebsite, website => website.Webs, website => website.Title);
clientContext.ExecuteQuery();
Console.WriteLine("Available sites Count: " + oWebsite.Webs.Count);
for (int i = 0; i < oWebsite.Webs.Count; i++)
{
Console.WriteLine("Site Title: " + oWebsite.Webs[i].Title);
orWebsite = oWebsite.Webs[i];
getSubWebs(orWebsite,path);
}
}
catch (Exception ex)
{
}
return orWebsite;
}
static void Main(string[] args)
{
Sub obj = new Sub();
ClientContext clientContext = new ClientContext("
http://triad102:5000");
Web oWebsite = clientContext.Web;
clientContext.Load(oWebsite);
clientContext.ExecuteQuery();
Web oweb= getSubWebs(oWebsite, "
http://triad102:5000");
}