Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static List<String> GetAllSites(string spURL)
- {
- IList<String> sites = new List<String>();
- try
- {
- SPSite oSiteCollection = new SPSite(spURL);
- SPWebCollection collWebsite = oSiteCollection.AllWebs;
- for (int i = 0; i < collWebsite.Count; i++)
- {
- using (SPWeb oWebsite = collWebsite[i])
- {
- LogBase.Log(LogTarget.File,collWebsite[i].ToString());
- SPListCollection collList = oWebsite.Lists;
- for (int j = 0; j < collList.Count; j++)
- {
- sites.Add(collWebsite[i].Title + collList[j].Title);
- }
- }
- }
- }
- catch (Exception ex)
- {
- LogBase.Log(LogTarget.File, ex.StackTrace + ex.Message);
- }
- return sites.ToList();
- }
Add Comment
Please, Sign In to add comment