Condividi tramite


SPServiceCollection Class

Represents a collection of SPService objects.

Inheritance Hierarchy

System.Object
  Microsoft.SharePoint.Administration.SPPersistedObjectCollection<SPService>
    Microsoft.SharePoint.Administration.SPPersistedChildCollection<SPService>
      Microsoft.SharePoint.Administration.SPServiceCollection

Namespace:  Microsoft.SharePoint.Administration
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No

Syntax

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

Remarks

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

Reference

SPServiceCollection Members

Microsoft.SharePoint.Administration Namespace