共用方式為


SPGlobalAdmin class

NOTE: This API is now obsolete.

在Windows SharePoint Services 2.0, SPGlobalAdmin表示部署的權限管理的最上層物件,並維持回溯相容性。而是使用新的SPFarmSPWebService類別來管理SharePoint Foundation部署。

Inheritance hierarchy

System.Object
  Microsoft.SharePoint.Administration.SPGlobalAdmin

Namespace:  Microsoft.SharePoint.Administration
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

Syntax

'宣告
<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

Examples

下列程式碼範例會顯示在伺服器上,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>";
}

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.

請參閱

參照

SPGlobalAdmin members

Microsoft.SharePoint.Administration namespace