Share via


SPServerCollection class

Represents a collection of SPServer objects.

Inheritance hierarchy

System.Object
  Microsoft.SharePoint.Administration.SPPersistedObjectCollection<SPServer>
    Microsoft.SharePoint.Administration.SPPersistedChildCollection<SPServer>
      Microsoft.SharePoint.Administration.SPServerCollection

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

Syntax

'Declaration
<SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel := True)> _
Public NotInheritable Class SPServerCollection _
    Inherits SPPersistedChildCollection(Of SPServer)
'Usage
Dim instance As SPServerCollection
[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel = true)]
public sealed class SPServerCollection : SPPersistedChildCollection<SPServer>

Remarks

Use either the Servers property of the SPFarm class, or the SPServerCollection constructor, to get the collection of servers that is used in the specified server farm.

Use an indexer to return a single server from the collection. For example, if the collection is assigned to a variable named myServers, use myServers[index] in C#, or myServers(index) in Visual Basic, where index is either the GUID or the name that identifies the service.

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.

See also

Reference

SPServerCollection members

Microsoft.SharePoint.Administration namespace