Guest User

Untitled

a guest
Mar 19th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. static List<String> GetAllSites(string spURL)
  2. {
  3. IList<String> sites = new List<String>();
  4. try
  5. {
  6. SPSite oSiteCollection = new SPSite(spURL);
  7. SPWebCollection collWebsite = oSiteCollection.AllWebs;
  8.  
  9. for (int i = 0; i < collWebsite.Count; i++)
  10. {
  11. using (SPWeb oWebsite = collWebsite[i])
  12. {
  13. LogBase.Log(LogTarget.File,collWebsite[i].ToString());
  14. SPListCollection collList = oWebsite.Lists;
  15.  
  16. for (int j = 0; j < collList.Count; j++)
  17. {
  18. sites.Add(collWebsite[i].Title + collList[j].Title);
  19. }
  20. }
  21. }
  22. }
  23. catch (Exception ex)
  24. {
  25. LogBase.Log(LogTarget.File, ex.StackTrace + ex.Message);
  26. }
  27.  
  28. return sites.ToList();
  29. }
Add Comment
Please, Sign In to add comment