Step 8 (Optional): Define the Ribbon and Actions (Ribbon.xml)

SharePoint 2010

Now that you have added a task pane layout to an intermediate declarative Outlook solution, you can also add a custom ribbon file definition. The ribbon file specifies actions that are called from the ribbon.

Last modified: August 22, 2011

Applies to: SharePoint Server 2010

For example, many solutions have a button on the ribbon that opens the task pane. The behavior for opening the task pane would be an action. The ribbon file uses the standard ribbon schema that all Microsoft Office applications use.

Actions in Business Connectivity Services can be URL-based or code-based. URL-based actions navigate to a specified URL when the action is executed (for example, when a ribbon button is clicked). URL-based actions can be defined declaratively in the Ribbon.xml file. Code actions execute code when a ribbon button is clicked and must be created by a developer before they can be used.

The Code Sample: AdventureWorks2008 Declarative Outlook Solution has a custom ribbon menu, Contoso Sales Manager. When you click Contoso Sales Manager, two ribbon buttons are displayed, as follows:

  • Related Orders When clicked, displays the task pane with order history.

  • Phone Lookup When clicked, opens a browser window to the MSN phone lookup page and searches for the customer's phone number.

To create a ribbon file

  1. 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. Locate the Template: Ribbon.xml provided in the SDK, and copy it, and then save it to the Solution Artifacts folder as OutlookContactRibbon.xml.

    2. Open the OutlookContactRibbon.xml file for editing in an XML editor. If you are opening the XML file in Visual Studio, attach the Office ribbon schema (Office 2010 Reference: Office Fluent User Interface XML Schema). This gives you IntelliSense functionality and helps you create valid entries.

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

      <customUI xmlns="" 
                onLoad="OnLoad" loadImage="GetImage">
            <tab id="tabID" label="Contoso Sales Manager" 
                 getVisible="GetVisible" tag="Solution">
              <group id="CustomerSalesGroupID" label="Customer Sales" 
                <button id="relatedOrderHeaderButton"
                            label="Customer Orders"
                          getEnabled ="GetEnabled"
              <group id="CustomerActionsGroupID" label="Customer Actions" 
                <button id="SearchCustomerByPhoneButton"
                           label="Phone Lookup"
                         getEnabled ="GetEnabled"
    4. Save the file and then close it.

  2. Open the OIR.config file for editing. Update OIR.config to specify which ribbon file to load, by adding the RibbonFileName attribute, as shown in the following example.

      ItemType="OutlookContact" RibbonFileName="OutlookContactRibbon.xml">
  3. Add a ContextDefinitionGroup for the Order association to specify how to get Order external items, as shown in the following example. This is an optional step and is required only if you want to surface actions in the Rich List Part.

    <ContextDefinitionGroup ItemType="EntityView">
      <!-- The content type has to be in the format: -->
      <!-- length_of_entity_namespace="" length_of_entity_name="" 
      length_of_view_name="" entity_namespace="" entity_name="" 
      view_name="" position_of_entity_namespace="" -->
        ContentType="12 12 24 AWWSExample OrderHeader GetSalesOrderHeaderById 9" 
          <Entity Name="OrderHeader" EntityTypeName="OrderHeader" 
            <View Name="PrimaryEntityNameInContext" 
                  Description="GetSalesOrderHeaderById" IsPrimary="true" />
          <Declarative:Layout Name="Edit" LayoutFileName="EditOrderHeader">
              <Declarative:Property Name="AssociatedActionType" Value="Edit" />
          <Declarative:CodeMethodAction MethodType="EditEntity" Name="Edit" 
                                        Caption="Edit Order" 
                                        DisplayOrder="2" Scope="ItemContext" />
  4. Update the OIR.config file to give the BCS Client Runtime the information about the ribbon buttons you want and the associated actions for the Customer ContextDefinition. Add the following code below the <Declarative:Layouts> tag in the Customer ContextDefinition.

      <Declarative:CodeMethodAction Name ="RelatedOrderHeaderAction" 
                                    MethodType ="ShowTaskpaneLayout">
          <Declarative:ConstantParameter Name="Para1" 
      <Declarative:ContextActivated ActionName="RelatedOrderHeaderAction" />
  5. Save the file and then close it.

  6. Package the solution, deploy it, and then test it to ensure that it works as expected.

You have now successfully created an intermediate declarative Outlook solution.