Advertisement
Guest User

Untitled

a guest
Aug 30th, 2016
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. public DataTable GetAllSiteCollections(string url)
  2. {
  3. DataTable dt = new DataTable();
  4. dt.Columns.Add("URL");
  5. dt.Columns.Add("Name");
  6. SPSecurity.RunWithElevatedPrivileges(delegate()
  7. {
  8. SPWebApplication webApplication = SPWebApplication.Lookup(new Uri(url));
  9. foreach (SPSite site in webApplication.Sites)
  10. {
  11. dt.Rows.Add(new object[] { site.Url, site.Url });
  12. }
  13. });
  14.  
  15. return dt;
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement