SPServiceCollection class

Represents a collection of SPService objects.

Inheritance hierarchy


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


<GuidAttribute("6CEF670D-FE58-4b38-AF3B-43E7C9365E99")> _
<SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel := True)> _
Public NotInheritable Class SPServiceCollection _
    Inherits SPPersistedChildCollection(Of SPService)
Dim instance As SPServiceCollection
[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel = true)]
public sealed class SPServiceCollection : SPPersistedChildCollection<SPService>


Use the Services property of the SPFarm class to return an SPServiceCollection object that represents the collection of services on the server farm. To add a service to the server farm, use the Add method of the SPPersistedChildCollection<T> class.

Use an indexer to return a single service from the collection. For example, if the collection is assigned to a variable named myServices, use myServices[index] in C#, or myServices(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


SPServiceCollection members

Microsoft.SharePoint.Administration namespace