Step 7 (Optional): Show External Data Parts in Outlook Task Pane (Layout.xml)

SharePoint 2010

With Microsoft Business Connectivity Services (BCS), you can easily show external data parts in Outlook task panes. Business Connectivity Services provides two external data parts, Rich List Part and an InfoPath Part. The Rich List Part shows a list of entries from an external system. The InfoPath Part can show any InfoPath form (even forms with code-behind).

Last modified: August 22, 2011

Applies to: SharePoint Server 2010

Figure 1 shows how, in the Code Sample: AdventureWorks2008 Declarative Outlook Solution sample, related orders of the customer are displayed in a list by using the Rich List Part and details of an order are displayed in an InfoPath Part.

Figure 1. External Data Parts showing order history in the Outlook task pane

Related Customer order in list external data part

In addition to these two external data parts, you can display any custom external data part that is already created by a developer.

After you have the external data parts you want to display in a task pane, you can create a layout file. This file defines the controls that are surfaced in the task pane, which external content types they should be populated with, and any other custom properties that the control exposes.

Finally, you should update the OIR.config file with the task pane behavior you want in your solution.

To create a task pane layout

  1. Create an external list for the Order external content type by using Microsoft SharePoint Designer 2010. For more information, see How to: Create External Lists in SharePoint.

  2. Create an InfoPath form for the external list. To do this, see How to: Customize External List Forms Using Microsoft InfoPath. Then, export the form by using SharePoint Designer 2010.

  3. Open the form in Microsoft InfoPath 2010 Designer and customize it the way you want.

    Save the form to the solution artifacts folder and close it.

  4. Create a layout file to specify the layout of the Rich List Part and InfoPath Form Part in the Outlook task pane. You can use the BCS Artifact Generator Tool to create the form region manifest file based on the BDC model.

    Alternately, you can author the form region manifest manually, as follows.

    1. Make a copy of the Template: Layout.xml provided in the Microsoft SharePoint 2010 Software Development Kit (SDK), and save it to the Solution Artifacts folder as RelatedOrderHeader.xml.

    2. Open the RelatedOrderHeader.xml in an XML editor for editing. If you are opening the XML file in Visual Studio, attach the Layout schema (LayoutDefinitions.xsd). This will give you IntelliSense functionality, and also help you create valid entries. See LayoutDefinitions Schema and LayoutDefinitions Schema Custom Properties for schema documentation.

    3. Replace the values marked with EnterX in the XML with valid values. The following XML example shows how the file might look after editing.

      <?xml version="1.0" encoding="utf-8" ?>
      <Container ContainerType="Stack" 
          <OBPart PartType="List" DataSourceName="PrimaryEntityNameInContext" 
                  Text="Related Order" Description="A list of all related Orders" >
            <CustomProperties >
              <CustomProperty Name="DataSourceMode" Value="AssociationList" />
              <CustomProperty Name="DataMemberName" Value="GetOrdersForCustomer" />
              <CustomProperty Name="MaximumVisibleRowCount" Value="12" />
              <CustomProperty Name="DefaultActionName" Value="Edit" />
              <CustomProperty Name="DefaultActionSource" Value="TargetContext" />
              <CustomProperty Name="ConsumerPartName" Value="IPOBP" />
              <CustomProperty Name="ColumnsXml" Value="&lt;Columns&gt;&lt;
                Column DisplayName=&quot; &quot; Name=&quot;$SyncState$&quot; /&gt;&lt;
                Column FormatString=&quot;d&quot; DisplayName=&quot;Order Date&quot; 
                Name=&quot;OrderDate&quot;/&gt;&lt;Column FormatString=&quot;#.00&quot; 
                DisplayName=&quot;Total Due&quot; Name=&quot;
                TotalDue&quot; /&gt;&lt;/Columns&gt;" />  
          <OBPart PartType="InfoPath">
              <CustomProperty Name="Name" Value="IPOBP" />
              <CustomProperty Name="FormLocation" Value="OrderHeaderTemplate.xsn" />
              <CustomProperty Name="IsReadOnly" Value="True" />
              <CustomProperty Name="Height" Value="1000" />
               <CustomProperty Name="ViewName" Value="taskpaneview" />
    4. Save the file and then close it.

  5. Open the OIR.config file for editing. Add this entry at the bottom of the Customer ContextDefinition to notify the BCS Client Runtime that you want to host this layout in the task pane when a customer is in context in Outlook.

      <Declarative:Layout Name="RelatedOrderHeader" 
  6. Save the file and then close it.

Next, you need to create an action to show the task pane and create a ribbon file to show the action.