Saturday, July 5, 2008

Connecting Web Parts in SharePoint Portal Server 2003, Part 1

Microsoft's SharePoint Portal Server lets different developers and organisations develop Web Parts that can communicate with each other. A Web Part is a modular unit of information that works with Windows SharePoint Services Web sites only.

Web Parts contain Web-based content and are the building block of a Web Part Page. You can also create connections between Web Parts so that when you perform an action in one Web Part, it changes the contents of another Web Part.

The SharePoint architecture supports standard Connection Interfaces for passing information among Web Parts at runtime. The connectable Web Part will act as a provider Web Part by providing information to another Web Part or as a consumer Web Part by consuming information from a provider Web Part. Two Web Parts supported by a connection interface can be connected by an end user with either Microsoft Office Front Page or an Internet browser.

Connection Interface Details

There are few a different connection interfaces that provide different behaviors. The difference is mainly found in the amount of information that can be passed from one to another. For example, one interface can support providing a single value to a consumer Web Part. There are other interfaces that support more than a single value.

The connectable Web Part raises an interface event that executes an action in Web Parts connected to it. These connection interfaces act as pairs by either being a provider or consumer Web Part. An event from the provider will trigger an action in the consumer Web Part, and an event from the consumer Web Part will trigger an action in the provider Web Part. The following are some of the connection interface pairs and their functionality.

Connection Interface Pairs and Their Functionality
Connection Interface Pair Functionality
ICellProvider, ICellConsumer Provide or consume a single value from one Web Part to another.
IRowProvider, IRowConsumer Provide or consume a single or multiple rows of values from one Web Part to another.
IListProvider, IListConsumer Provide or consume an entire list from one Web Part to another.
IFilterProvider, IFilterConsumer Provide or consume a filter value.

There are more connection interfaces available from the SharePoint architecture. However, I am mainly looking at interfaces connected using an Internet browser. There are a few more interfaces that are supported by Microsoft Front Page.

Web Parts can be connected only if they are compatible with each other. If Web Parts are not compatible, the Connection menu item in the Web Part will be disabled, and a tool tip will display the reason why it is disabled.

Compatibility Rules

The Web Part won't be able to connect to itself either directly or through a chain of connections. There are a few compatibility rules that SharePoint architecture follows when determining whether the Web Parts are compatible.

  • Are the Web Parts connecting as opposite pairs? For example, only ICellProvider interface can be connect with ICellConsumer interface.

  • Is the Web Part connecting through a Transformer? The Web Part architecture supports connecting dissimilar Web Parts with each other through transformers. For example, the IRowProvider Web Part can connect with either the IRowConsumer or the ICellConsumer Web Part. When it is connected to an ICellConsumer Web Part, the transformer determines which field will be consumed from the provider Web Part. The following are some of the transformers supported by connecting through a browser:

    IRowProvider to ICellConsumer
    IRowProvider to IFilterConsumer

The following are some of the interfaces that support the cross page connections. This means Web Parts in two different pages can communicate with each other.

Interfaces Supporting Cross Page Connection
Source page Interface Target page Interface
IRowProvider IFilterConsumer
IFilterProvider IFilterConsumer

Web Parts can run on the client side, server side, or both. The connectable Web Part only can connect with other connectable Web Parts in the same location. This means both Web Parts should run either client side or server side. A client side Web Part won't be able to connect to a server side Web Part and vice versa.

When the developer creates the Web Part, he can determine the number of connections supported by the Web Part. This is done when the interface is registered in the code. The connection number can be either one or unlimited.

Connect Web Parts Through an Internet Browser

According to the SharePoint Portal Server 2003 Client section on Microsoft's SharePoint Portal Server 2003 System Requirements page, "To use the SharePoint Portal Server 2003 client, you need:

Portal access

  • Microsoft Internet Explorer 5.01, plus the latest service pack
  • Internet Explorer 5.5, plus the latest service pack
  • Internet Explorer 6, plus the latest service pack
  • Internet Explorer 5.2 for Mac OS X, plus the latest service pack
  • Netscape Navigator 6.2 or later
  • Netscape Navigator 6.2 for Mac
  • Netscape Navigator 6.2 for UNIX

Portal management

  • Internet Explorer 5.5, plus the latest service pack
  • Internet Explorer 6, plus the latest service pack
The Web page that contains the Web Parts should be in design view to support the connection functionality; otherwise, the connecting Web Part option won't be available to the end user. To access the design view of a SharePoint Web page, navigate to the top right hand corner and select Modify My Page or Modify Shared Page depending on whether the end user is using personal or shared view. Then select Design this page option from the dropdown menu as displayed below.

A right mark will indicate whether the page is in design view as displayed below.

There are more options available in a Web Part menu when its holding page is in design view. The Web Parts "Connections" option only is available when the Web Part is displayed in design view.

No comments: