Export (0) Print
Expand All

SPGlobalAdmin Class

Windows SharePoint Services 3

NOTE: This API is now obsolete.

Use the new SPFarm and SPWebService classes instead, to manage a Windows SharePoint Services deployment. (In Windows SharePoint Services 2.0, SPGlobalAdmin represented the top-level object for administration of a deployment, and is maintained for backward compatibility.)

System.Object
  Microsoft.SharePoint.Administration.SPGlobalAdmin

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>";
}

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

Community Additions

ADD
Show:
© 2014 Microsoft