SPGlobalAdmin class
SharePoint 2013
NOTE: This API is now obsolete.
In Windows SharePoint Services 2.0, SPGlobalAdmin represented the top-level object for administration of a deployment, and is maintained for backward compatibility. Use the new SPFarm and SPWebService classes instead, to manage a SharePoint Foundation deployment.
Namespace:
Microsoft.SharePoint.Administration
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
[ObsoleteAttribute("Most of the functionality in this class is available in SPFarm or SPWebService.", false)] [SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel = true)] [SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel = true)] public class SPGlobalAdmin : IDisposable
The following code example displays the SharePoint administrators group account, the host name for the specified virtual server, and usage information for all SharePoint sites on the server.
This example assumes the existence of a label control on an .aspx page.
SPGlobalAdmin globAdmin = new SPGlobalAdmin(); SPGlobalConfig globConfig= globAdmin.Config; SPVirtualServer vServer = globAdmin.VirtualServers[0]; Label1.Text += "Administrator Group: " + globConfig.AdminGroup + "Host: " + vServer.HostName + "<BR>"; SPSiteCollection sites = vServer.Sites; foreach (SPSite site in sites) { SPSite.UsageInfo uInfo = site.Usage; Label1.Text += "URL: " + site.Url + " Bandwidth: " + uInfo.Bandwidth.ToString() + " Hits: " + uInfo.Hits.ToString() +" Visits: " + uInfo.Visits.ToString() + "<BR>"; }