SPGlobalAdmin 类

请注意:此 API 现在已过时。

在Windows SharePoint Services 2.0, SPGlobalAdmin表示的部署,管理的顶级对象,并保持向后兼容性。而是使用新的SPFarmSPWebService类管理SharePoint Foundation部署。

继承层次结构

System.Object
  Microsoft.SharePoint.Administration.SPGlobalAdmin

命名空间:  Microsoft.SharePoint.Administration
程序集:  Microsoft.SharePoint(位于 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 _
    Implements IDisposable
用法
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

示例

下面的代码示例显示服务器上的 SharePoint 管理员组帐户,指定的虚拟服务器的主机名和所有 SharePoint 网站的使用信息。

此示例假定存在的.aspx 页上的标签控件。

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

线程安全性

该类型的任何公共 静态 (已共享 在 Visual Basic 中) 成员都是线程安全的。不保证任何实例成员都是线程安全的。

另请参阅

引用

SPGlobalAdmin 成员

Microsoft.SharePoint.Administration 命名空间