SPWebServiceInstanceCollection class

Represents a collection of SPWebServiceInstance objects.

Inheritance hierarchy

System.Object
  Microsoft.SharePoint.Administration.SPPersistedObjectCollection<SPWebServiceInstance>
    Microsoft.SharePoint.Administration.SPPersistedChildCollection<SPWebServiceInstance>
      Microsoft.SharePoint.Administration.SPWebServiceInstanceCollection

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

Syntax

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

Remarks

Use the inherited Instances property of the SPWebService class to return an SPServiceInstanceDependencyCollection object that represents all instances of the database service. Use the SPWebServiceInstanceCollection constructor to access the collection of Web service instances that run on a specific server.

You can use the inherited Instances property on the ContentService or AdministrationService property of the SPWebService class to return a collection of dependent instances for the content or administration service, and then iterate through the collection to cast the instances as Web service instances, as in the following:

Dim webServiceInstance As SPWebServiceInstance
For Each webServiceInstance In SPWebService.ContentService.Instances
    ...
Next webServiceInstance
foreach(SPWebServiceInstance webServiceInstance in SPWebService.ContentService.Instances)
{...}

To add a Web service instance to the collection, use the Add method.

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

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

SPWebServiceInstanceCollection members

Microsoft.SharePoint.Administration namespace