共用方式為


SPServer class

代表伺服器陣列中的實體電腦。

Inheritance hierarchy

System.Object
  Microsoft.SharePoint.Administration.SPAutoSerializingObject
    Microsoft.SharePoint.Administration.SPPersistedObject
      Microsoft.SharePoint.Administration.SPPersistedUpgradableObject
        Microsoft.SharePoint.Administration.SPServer

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

Syntax

'宣告
<UpgradableAttribute> _
<GuidAttribute("E77AAF47-3CAC-4001-BC6B-5BCCB6486318")> _
<SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel := True)> _
Public NotInheritable Class SPServer _
    Inherits SPPersistedUpgradableObject
'用途
Dim instance As SPServer
[UpgradableAttribute]
[GuidAttribute("E77AAF47-3CAC-4001-BC6B-5BCCB6486318")]
[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel = true)]
public sealed class SPServer : SPPersistedUpgradableObject

備註

使用ServersSPFarm類別屬性,或是SPServerCollection建構函式,來取得指定之的伺服器陣列中所用的伺服器的集合。若要從集合中傳回單一伺服器使用索引器。例如,若集合已指派給變數myServers,使用myServers[index]以 C# 或 Visual Basic,其中index是 GUID 或名稱識別服務中的myServers(index) 。

Examples

下列範例會修改名稱和伺服器陣列中現有的伺服器角色。

Dim servers As SPServerCollection = SPFarm.Local.Servers

Dim myServer As SPServer = servers("myExistingServer")
myServer.Name = "NewServerName"
myServer.Role = SPServerRole.Application
myServer.Update()
SPServerCollection servers = SPFarm.Local.Servers;

SPServer myServer = servers["myExistingServer"];
myServer.Name = "NewServerName";
myServer.Role = SPServerRole.Application;
myServer.Update();

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.

請參閱

參照

SPServer members

Microsoft.SharePoint.Administration namespace