SPWebPartManager.SPConnectWebParts 方法 (WebPart, ProviderConnectionPoint, WebPart, ConsumerConnectionPoint, WebPartTransformer)

创建使用指定的 Web 部件、 指定的ConnectionPoint对象与指定的WebPartTransformer引用的两个 Web 部件之间SPWebPartConnection

命名空间:  Microsoft.SharePoint.WebPartPages
程序集:  Microsoft.SharePoint(位于 Microsoft.SharePoint.dll 中)

语法

声明
Public Function SPConnectWebParts ( _
    provider As WebPart, _
    providerConnectionPoint As ProviderConnectionPoint, _
    consumer As WebPart, _
    consumerConnectionPoint As ConsumerConnectionPoint, _
    transformer As WebPartTransformer _
) As SPWebPartConnection
用法
Dim instance As SPWebPartManager
Dim provider As WebPart
Dim providerConnectionPoint As ProviderConnectionPoint
Dim consumer As WebPart
Dim consumerConnectionPoint As ConsumerConnectionPoint
Dim transformer As WebPartTransformer
Dim returnValue As SPWebPartConnection

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

参数

返回值

类型:Microsoft.SharePoint.WebPartPages.SPWebPartConnection
包含有关provider、 consumer和transformer连接所需的信息SPWebPartConnection

异常

异常 条件
WebPartPageUserException
  1. providerConnectionPoint和consumerConnectionPoint是Windows SharePoint Services 2.0连接接口。

  2. 关闭consumer或provider Web 部件

  3. providerConnectionPoint或consumerConnectionPoint无法参与连接。

  4. 多个连接尝试providerConnectionPoint或consumerConnectionPoint上并且连接不支持多个连接。

  5. consumerConnectionPoint和providerConnectionPoint接口不相同的类型和转换器既未提供或转换器不支持所需的providerConnectionPoint或consumerConnectionPoint的界面类型

InvalidOperationException

provider或consumer Web 部件不在区域中

备注

使用此重载连接 Web 部件时其连接点不兼容。consumer和provider实现不同的接口时,发生此事件不兼容。

另请参阅

引用

SPWebPartManager 类

SPWebPartManager 成员

SPConnectWebParts 重载

Microsoft.SharePoint.WebPartPages 命名空间