Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
SPWebServiceInstanceCollection class
Collapse the table of content
Expand the table of content

SPWebServiceInstanceCollection class

Represents a collection of SPWebServiceInstance objects.

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

[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel = true)]
public sealed class SPWebServiceInstanceCollection : SPPersistedChildCollection<SPWebServiceInstance>

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:

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.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show:
© 2015 Microsoft