SPWebServiceInstanceCollection class
代表SPWebServiceInstance物件的集合。
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
'宣告
<SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel := True)> _
Public NotInheritable Class SPWebServiceInstanceCollection _
Inherits SPPersistedChildCollection(Of SPWebServiceInstance)
'用途
Dim instance As SPWebServiceInstanceCollection
[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel = true)]
public sealed class SPWebServiceInstanceCollection : SPPersistedChildCollection<SPWebServiceInstance>
備註
使用SPWebService類別繼承的Instances屬性可傳回SPServiceInstanceDependencyCollection物件,代表所有的資料庫服務執行個體。使用SPWebServiceInstanceCollection建構函式來存取特定的伺服器執行的 Web 服務執行個體的集合。
您可以使用繼承的Instances屬性ContentService或AdministrationServiceSPWebService類別的屬性,傳回一組相依的執行個體的內容或管理服務,再逐一查看集合轉換為 Web 服務執行個體,如下列所示的執行個體:
Dim webServiceInstance As SPWebServiceInstance
For Each webServiceInstance In SPWebService.ContentService.Instances
...
Next webServiceInstance
foreach(SPWebServiceInstance webServiceInstance in SPWebService.ContentService.Instances)
{...}
若要新增至集合中的 Web 服務執行個體,使用Add方法。
若要從集合中傳回單一的 Web 服務執行個體使用索引器。例如,若集合已指派給變數 myWebServiceInstances,使用myWebServiceInstances[index]以 C# 或 Visual Basic,其中index是名稱或 GUID 識別的 Web 服務執行個體中的myWebServiceInstances(index) 。
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.