0

I need to access following structure on SP server with following structure. I have tried SPWebApp, SPWeb, SPSite and GetSubwebsForCurrentUser but I am missing something and I am not able to get data past branch Trees.

Please note that I do not have access to ClientContext (using network credentials with Admin account gives access denied error).

Any help will be appreciated.

\sites\Trees
\sites\Trees\Planted\Apples
\sites\Trees\Planted\1203\Pears
\sites\Trees\Planted\1203\Apples
\sites\Trees\Relocated\1104\Fer
\sites\Trees\Relocated\1104\Fer\local
\sites\Trees\Relocated\1104\Fer\invader

Thanks

BeHappy
  • 138
  • 2
  • 17

1 Answers1

0
private List<string> GetChildSites(string URL)
    {
        List<string> sitesList = new List<string>();
        using (SPSite site = new SPSite(URL))
        {
            foreach (SPWeb web in site.AllWebs)
            {
                sitesList.Add(web.Url);

                web.Dispose();
            }
        }
        return sitesList;
    }
BeHappy
  • 138
  • 2
  • 17