SPWebPartManager.SPConnectWebParts Method (WebPart, ProviderConnectionPoint, WebPart, ConsumerConnectionPoint, WebPartTransformer)

Creates a SPWebPartConnection between two Web Parts with the references to the specified Web Parts, the specified ConnectionPoint objects and a specified WebPartTransformer.

Namespace:  Microsoft.SharePoint.WebPartPages
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No

Syntax

'Declaration
Public Function SPConnectWebParts ( _
    provider As WebPart, _
    providerConnectionPoint As ProviderConnectionPoint, _
    consumer As WebPart, _
    consumerConnectionPoint As ConsumerConnectionPoint, _
    transformer As WebPartTransformer _
) As SPWebPartConnection
'Usage
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
)

Parameters

Return Value

Type: Microsoft.SharePoint.WebPartPages.SPWebPartConnection
A SPWebPartConnection that contains the information about the provider, consumer, and transformer needed for a connection.

Exceptions

Exception Condition
WebPartPageUserException
  1. Both providerConnectionPoint and consumerConnectionPoint are Windows SharePoint Services 2.0 connection interfaces.

  2. Either the consumer or provider Web Parts are closed

  3. Either the providerConnectionPoint or consumerConnectionPoint cannot participate in connection.

  4. Multiple connections are attempted on the providerConnectionPoint or consumerConnectionPoint and the connection does not support multiple connections.

  5. The consumerConnectionPoint and providerConnectionPoint interfaces are not the same type and a transformer was either not provided or the transformer does not support the interface types required by the providerConnectionPoint or the consumerConnectionPoint

InvalidOperationException

The provider or consumer Web Part is not in a zone

Remarks

This overload is used to connect Web Parts when their connection points are incompatible. The incompatibility occurs when the consumer and provider implement different interfaces.

See Also

Reference

SPWebPartManager Class

SPWebPartManager Members

SPConnectWebParts Overload

Microsoft.SharePoint.WebPartPages Namespace