共用方式為


SPWebPartManager.SPConnectWebParts method (WebPart, ProviderConnectionPoint, WebPart, ConsumerConnectionPoint)

建立與指定的 Web 組件的參考的兩個 Web 組件和指定的ConnectionPoint物件之間的SPWebPartConnection

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

Syntax

'宣告
Public Function SPConnectWebParts ( _
    provider As WebPart, _
    providerConnectionPoint As ProviderConnectionPoint, _
    consumer As WebPart, _
    consumerConnectionPoint As ConsumerConnectionPoint _
) As SPWebPartConnection
'用途
Dim instance As SPWebPartManager
Dim provider As WebPart
Dim providerConnectionPoint As ProviderConnectionPoint
Dim consumer As WebPart
Dim consumerConnectionPoint As ConsumerConnectionPoint
Dim returnValue As SPWebPartConnection

returnValue = instance.SPConnectWebParts(provider, _
    providerConnectionPoint, consumer, _
    consumerConnectionPoint)
public SPWebPartConnection SPConnectWebParts(
    WebPart provider,
    ProviderConnectionPoint providerConnectionPoint,
    WebPart consumer,
    ConsumerConnectionPoint consumerConnectionPoint
)

參數

傳回值

Type: Microsoft.SharePoint.WebPartPages.SPWebPartConnection
兩個 Web 組件之間的連線。

Exceptions

Exception Condition
WebPartPageUserException
  1. providerConnectionPoint和consumerConnectionPoint是Windows SharePoint Services 2.0連線介面。

  2. consumer或provider網頁組件就會關閉。

  3. providerConnectionPoint或consumerConnectionPoint無法參與連接。

  4. 多個連線嘗試在providerConnectionPoint或consumerConnectionPoint ,而且連線不支援多個連線。

  5. consumerConnectionPoint和providerConnectionPoint介面並不相同的型別,轉換程式可能未提供或轉換程式不支援providerConnectionPoint或consumerConnectionPoint所需的介面型別。

InvalidOperationException

提供者或消費者 Web 組件不在區域中。

備註

這個多載用來連接 Web 組件,當其連接點會完全相容它們可以連線而不使用WebPartTransformer物件。

請參閱

參照

SPWebPartManager class

SPWebPartManager members

SPConnectWebParts overload

Microsoft.SharePoint.WebPartPages namespace