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.
Inheritance Hierarchy
System.Object
Microsoft.SharePoint.Administration.SPGlobalAdmin
Namespace: Microsoft.SharePoint.Administration
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No
Syntax
'Declaration
<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 _
Implements IDisposable
'Usage
Dim instance As SPGlobalAdmin
[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
Examples
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.
Dim globAdmin As New SPGlobalAdmin()
Dim globConfig As SPGlobalConfig = globAdmin.Config
Dim vServer As SPVirtualServer = globAdmin.VirtualServers(0)
Label1.Text += "Administrator Group: " + globConfig.AdminGroup _
+ " Host: " + vServer.HostName + "<BR>"
Dim sites As SPSiteCollection = vServer.Sites
Dim site As SPSite
For Each site In sites
Dim uInfo As SPSite.UsageInfo = site.Usage
Label1.Text += "URL: " + site.Url + " Bandwidth: " + uInfo.Bandwidth.ToString() _
+ " Hits: " + uInfo.Hits.ToString() + " Visits: " + uInfo.Visits.ToString() + "<BR>"
Next site
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>";
}
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.