SPServer 类

表示在服务器场中的物理计算机。

继承层次结构

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

命名空间:  Microsoft.SharePoint.Administration
程序集:  Microsoft.SharePoint(位于 Microsoft.SharePoint.dll 中)

语法

声明
<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的变量中,使用在 C# myServers[index]或myServers(index)在 Visual Basic,其中index是用于标识该服务的名称或 GUID。

示例

下面的示例修改名称和服务器场中的现有服务器角色。

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();

线程安全性

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

另请参阅

引用

SPServer 成员

Microsoft.SharePoint.Administration 命名空间