SPGlobalAdmin Class

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)
Available in Sandboxed Solutions: No

[ObsoleteAttribute("Most of the functionality in this class is available in SPFarm or SPWebService.", 
[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>";

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.