Click here to Skip to main content
15,881,413 members
Articles / Web Development / XHTML
Article

Information Bridge 1.5 Walkthrough - Part 2

Rate me:
Please Sign up or sign in to vote.
4.43/5 (6 votes)
2 Apr 200528 min read 68.3K   112   18   15
A look at the advanced features of IBF 1.5.

Purpose

The purpose of this article is to expand upon the previous, part one, walkthrough by incorporating some of the more advanced features of the Information Bridge Framework (IBF). In part one, I provided a brief introduction to IBF and why it was developed into a product. I also created a sample walkthrough that demonstrated the basic features of IBF 1.5. Part one should have provided you with a good starting point to create a more robust IBF application.

Part two will be build on this by enabling the user to perform specific actions from a custom Smart Tag, like: Get All Customers, or See Customer Details. We will also allow the user to search for customers from the IBF search task pane. Finally, we will create a standard Word template and attach an IBF schema that will allow the user to view, update and add customer information directly from the IBF task pane. The tasks involved are listed below:

  1. IBF search panes.
  2. Custom smart tag actions and menu items.
  3. Microsoft Word attached schemas.
  4. Working with office from the IBF task pane.
  5. Client deployment.

Recap

To recap, in Part one, we created a simple IBF solution that enabled users to retrieve details on Northwind customers from within Microsoft Word. From a Word document, we can type in any Northwind customer ID and from a Smart tag get their corresponding details. The tasks involved to accomplish this are listed below:

  1. Create a .NET IBF solution.
  2. Create an IBF compliant Web services.
  3. Using the 1.5 Metadata guidance task pane to do the following:
    1. Import your IBF compliant web services.
    2. Creating your first entities and actions.
    3. Creating a .NET Windows Form region.
  4. Testing your IBF solution.
  5. Creating a basic Smart tag recognizer.
  6. Testing your application in Word.

Assumption

Before I continue creating the advanced Information Bridge solution, there are several prerequisites that I assume you are already familiar with and have previously configured in your development environment:

  1. You are familiar with the Microsoft Visual Studio .NET 2003 development platform.
  2. You have access to the SQL Server Northwind database and are familiar with the database structures.
  3. You have the Information Bridge 1.5 server installed and configured on your server, as well as the IBF 1.5 SDK.
  4. You have the full installation of Microsoft Office 2003.
  5. You understand the following concepts: Web Services, .NET C#, .NET Windows control development, Microsoft Office 2003 Word, Excel and Outlook and Office Smart tags.
  6. You have worked with XML and XSLT.
  7. You know how to sign an assembly with a strong name.
  8. You have the Smart tag SDK installed on your system.
  9. You have downloaded the images and listings at the top of this article.
  10. You have already read Part 1 of the sample walkthrough.
  11. You have already installed Part 1 of the sample walkthrough and it is working on your system.

Walkthrough

This walkthrough will provide you with instructions for creating a complete IBF solution using the newly released 1.5 framework. This is part two of the sample, so I will be building off the part one sample solution.

Like part one, I am going to revolve the application around the standard Northwind database. I will be using this model, because I figure that most of you are familiar with the database schema and if you aren't, there are many documents on it that you can get from Microsoft.

IBF Search Panes

The IBF Search region is a specific window on the IBF task pane that allows a user to search and retrieve results from any Line of Business (LOB) application. This pane is pre designed for search capabilities. It will allow you to select search criteria, enter in search parameters and display the results. To view this region, navigate to the appropriate tab on the IBF Task Pane. (Refer to Figure 1.)

For this walkthrough, I want the user to be able to navigate to the IBF search pane, enter a Customer ID, and then retrieve the details. In Part one, we created the actions, operations and ports to accomplish this. We just need to create a specific search port and transformation so that IBF knows that this is a function that should be performed on the search pane.

To create the appropriate metadata, I will be using the IBF metadata guidance window to initiate the wizard that will guide us through the steps. The wizard steps are listed below:

  1. Open up the IBFDemo sample solution that was created in Part 1.
  2. Click on the "Search Definition Wizard" hyperlink on the metadata guidance window.
  3. The second screen of the wizard allows us to select or create a new metadata solution. Since we have already created the NorthwindIBFSolution, we will use that solution to house our search scope. (Refer to Figure 2.)
  4. On the third screen we will select the View_Locator that we want to use for this search. Since the requirement is to enter a CustomerID, and then retrieve the results, we will use the Customer_View we have already created. Use the following parameters to populate the wizard:
    • Metadata Scope – NorthwindIBF
    • Entity – Customers
    • View – Customre_View
    • View Locator – Xsd.CustomerID
    • Select the action option - enter context type
  5. The fourth wizard screen provides us with the input template for the action. This should be automatically populated for you, because we have already defined this in the View_Locator as the CustomerID schema. (Refer to Figure 3.)
  6. For the fifth screen, we will be providing where the search results will be displayed and from what category. The category is used, so that if multiple search scopes have been defined, a user can use the same IBF task pane to search for multiple Line of Business entities. The location of the search results can be in 1 of 3 locations, the SearchRegion, SearchPage or the ReferencePage. For this walkthrough enter "Northwind Customers" for the search category caption, and select SearchPage as the results location. (Refer to Figure 4.)
  7. The final wizard screen, that we have to populate, is to enter the search criterion for this query. This dialog lets you add multiple search criteria to get the exact results you want. (Refer to Figure 8.) To do this, we have to provide IBF with several pieces of information:
    • The label and description of the search criterion.
    • The actual XPath that will do the selecting of the data.
    • The type of selection, either a list or a simple text box.
    • If this field is required or not.

    Click on the "Add Criterion" button. This command lets us specify the above pieces of information for our query. From there enter the following information: (Refer to Figure 7.)

    • Caption name - Customer ID
    • Description – Search and retrieve details on a Northwind customer.
    • XPath – Click on the ellipse next to the data entry field. This will bring up the XPath creator. This dialog will automatically be populated with the appropriate input parameters for our query. Click on the CustomerID node and click OK. (Refer to Figure 6)
    • Control type – text
    • Required – Yes (Check this option.)
  8. Click through the last series of wizard screens and close the wizard.

This completes the creation of our new search metadata. You will notice that two metadata elements have been added to the Information Bridge Scope, a Port and a Transformation. To test out the search, publish the metadata to the IBF Service, then create a new Word document and open up the Information Bridge task pane, by selecting Tools --> Information Bridge. Once the Information Bridge task pane appears, you will notice that a new search scope has been defined and you can now type in a Customer ID. Once you hit the Submit button, the details for that Customer will be displayed. That's all there is to it. By simply entering the information in the wizard, the wizard created the appropriate metadata and the search is now active. (Refer to Figure 1.)

Note: It is important to note that the search Ports and Transformations will be located in the Information Bridge metadata scope. This is the common IBF scope that is shared by all applications.

Custom smart tag actions and menu items

The next area that I want to explore is the ability to create a custom smart tag menu item. As you saw in Part 1, when we created the recognizer for CustomerIDs, a default smart tag menu appears. This menu contains the standard IBF menu item, "Show Details". Typically, you would want a more descriptive name for this menu, such as "Show Northwind Customer Details". To accomplish this is fairly straight forward and IBF helps you out by providing you with an interface, and metadata to do this.

Below, I will walk you through the steps for creating this custom menu to display the Customer details.

  1. Within the sample walkthrough solution, add a new class to the IBFNorthwind_ST project. Rename the new class to, IBFNorthwindSelCustomerAction.
  2. Import the IBF and smart tag namespaces. (Refer to Listing 1.) Inherit the class from the IActionHandler interface. This interface implements the following methods that must be used by the action handler:
    • GetMenuItems – Gets the menu items to display when an appropriate term is recognized.
    • Initialize – This method is used to set up the action handle.
    • InvokeMenuItem – This method executes the specific action that the user selected from the smart tag menu.
  3. The next step will be creating the actual custom menu item. To accomplish this, we need to create a new class that inherits from the IBF IActionHandlerMenuItem interface. This class will house the ID and caption of the menu item. For this example, add a Sealed class, within the IBFNorthwindSelCustomerAction class and inherit it from the IActionHandlerMenuItem. Once you do this, you must implement the caption and ID properties as well as the constructor that will initiate the two properties. (Refer to Listing 2.)
  4. Now we will create the GetMenuItems method. This method will return the complete set of menu items that you want the smart tag to display when it recognizes some text. Within this method we will create an array of menu items and then add the menu item sealed class, we created above. (Refer to Listing 3.)
  5. Now we just have to write the code to execute the appropriate action, when a user clicks on the smart tag menu. To do this, we will create the code to determine what menu item was selected. This code will be added to the InvokeMenuItem method. (Refer to Listing 4.) Next we will create a custom method to call our specific ShowCustomerDetails, which will execute the specific IBF context to initiate the Customer_View. (Refer to Listing 5.)
  6. The final step is to add the IBF metadata to display the custom menu items. To do this follow the steps below:
    1. Open up the metadata explorer, if it is not already visible.
    2. Within the "InformationBridge" metadata scope, expand the ports node. Locate the GenericActionHandler port, right click on it and edit it. Modify the XML data template to reflect the custom smart tag namespace and class name. For this example, use the following XML. The modified elements are highlighted.
      XML
      <msibf:GenericActionHandler
         TypeName="IBFNorthwind_ST.IBFNorthwindSelCustomerAction" 
         xmlns:msibf=
           "http://schemas.microsoft.com/InformationBridge/2004">
       <YourInitializationData>
         xmlns=
          "http://schemas.microsoft.com/InformationBridge/2004/Metadata"
       </YourInitializationData>
      </msibf:GenericActionHandler>
    3. Finally, we have to create the custom action to initiate the custom smart tag menu. To do this, navigate to the following node in the "InformationBridge" metadata scope: Entities --> GenericSmartTags --> GenericActionHandlers --> Actions.
    4. Double click on the "[Add Action.]" node. On this dialog, we will create a new action. Set the following properties and hit OK.
      • NameNorthwindCustomerDetailsAction
      • TypeEnterContext
      • Parameters schemaMSIBF.GenericActionHandler
      • Sequential executionUnChecked

      Note: Sequential execution is used if you want to chain actions together. If you have more then one action that you want to run together, in a sequence, then you would check this option. Since this is the only action we want to execute, we do not require a sequence. (Refer to Figure 9)

    5. On the newly added action, double click on the action to bring up the action designer. All we need to do here is drag and drop the LoadActionHandler operation from the operations node to the action designer and set the Transformation instance to GenericActionHandler. (Refer to Figure 10.)
  7. Now we are ready to test the new smart tag menu Item. Save the solution and publish your metadata. Close all IBF compatible applications and open up a new Microsoft Word document. Type "LETSS" in the document. The recognizer should have picked up the text and underlined it in purple dots. Hover over the text and click on the smart tag. You should now see the custom menu item "Show Northwind Customer Details". If you click on this menu item, it will bring up the IBF task pane and display the appropriate customer details. (Refer to Figure 11.)

That completes the walkthrough of creating a custom smart tag menu item in IBF. In summary, we created a new class that inherited from the IActionHandler interface. Then we added a sub class that inherited from the IActionHandlerMenuItem interface. We set the properties and methods accordingly to display the correct menu item and context. We added the IBF metadata and that's it. Next I will walk you through the creation of an IBF attached schema document.

IBF attached schemas – default HTML region

Attached schemas are one of the most powerful features of IBF. This is possible because in Office 2003 you have the ability to attach a schema (XSD) to a document. Once a schema is attached to a document, users can enter specific business information, within predefined XML elements, making it easier for data collection, formatting and validation. For example, if your schema expects two child nodes, and only one is entered, Word will warn you. These are business rules that will work in your document without coding any VBA, or custom COM Add-In.

An IBF attached schema is no different than attaching a standard XSD to your Word document. The only requirements are that you specify specific IBF metadata elements into the schema, such as the metadata scope. An example of an IBF attached schema is listed below. (This is the schema we will use to attach to Word latter in the walkthrough – Refer to Listing 5.)

XML
<?xml version="1.0"?>
<xs:schema targetNamespace="NorthwindIBF" 
    xmlns:xs="http://www.w3.org/2001/XMLSchema" 
    xmlns:att="NorthwindIBF"
    elementFormDefault="qualified" id="NorthwindData">
  <xs:element name="NorthwindsCustomersDocument">
    <xs:complexType mixed="true">
      <xs:all>
        <xs:element name="Customers" type="att:Customers"/>
      </xs:all>
    </xs:complexType>
  </xs:element>
  <xs:complexType name="Customers">
    <xs:attribute name="CustomerID" type="xs:string"/>
  </xs:complexType>
</xs:schema>

As you can see, we specified the targetNamespace as the metadata scope that we want this IBF schema to reference. When you attach this schema to a Word document, which I will detail below, IBF will initiate the default action in this metadata scope. For example, based on the above XSD, in the NorthwindIBF metadata scope, the default Entity is Customers. The default View is Customer_View. IBF will read this information from the IBF metadata repository and automatically open up the IBF task pane and run the GetCustomerDetails_Action.

The problem is that this default action expects a parameter, CustomerID. If I am attaching a specific schema to a document, I might not have this customer information yet, so I don't want the default Customer_View to be the first action that IBF runs. I really want to create a default view that does not need any parameters, and then nest specific CustomerID elements under this default.

Since I want to create a new default Entity and view, which will work every time for my attached schema, I will be creating a HTML region that displays a welcome message. To create a HTML region, follow the steps below:

  1. In Visual Studio, on the metadata guidance window, click on the "Service Metadata Creation Wizard" hyperlink. This is the same wizard we used in part 1 to create the Customers Entity. I will not be going into the details of this wizard, if you need them, please refer to Part 1 of this walkthrough. For now, just enter the below parameters to create a simple Welcome entity.
    • Screen 1 – Select the "NorthwindIBF" metadata scope.
    • Screen 2 – Create a new entity, called "Welcome". The default reference schema will be "(none)". Finally, check the option to make this the default entity.
    • Screen 3 – Create a new View, called Welcome_View. The default reference schema will be "(none)". Finally, check the option to make this the default view.
    • Screen 4 – Finish the wizard, by clicking through the last three screens.
  2. The next step is to create a custom operation to initiate a HTML region. To do this, follow the steps below:
    1. Next we will create an operation to display the HTML region. Navigate to the Operations node in the "NorthwindIBF" metadata scope.
    2. Double click on the [Add Operation…] node. Set the following parameters and leave everything else the default.
      • NameNorthwind.Customer.Welcome
      • Entity – (none)
      • Operation TypeMSIBF.UI.ShowRegion
      • Input SchemaMSIBF.Text
      • Output Schema – (none)
      • Port – (none)
    3. The next step is the most important step. This involves creating the HTML region's XML. To do this, add the following XML to the "XML Properties" text section. (Refer to Listing 7)
      XML
      <iwb:Region 
          Enabled="true" 
          MetadataScopeName="NorthwindIBF" 
          EntityName="Welcome" 
          xmlns:iwb=
            "http://schemas.microsoft.com/InformationBridge/2004">
        <iwb:RegionProperties 
          RegionName="NorthwindWelcome" 
          Caption="Northwind Customer Maintenance" 
          Description="Northwind Customer Maintenance Application" 
          ShowAs="ExpandedRegion" 
          TypeName=
           "Microsoft.InformationBridge.Framework.UI.Controls.HtmlRegion">
          <iwb:XHTML Height="100">
            <body xmlns="http://www.w3.org/1999/xhtml">
              <div>
                <font color="#00006B" size="3">
                  <strong>Northwind Inc.</strong>
                </font>
              </div>
              <div>
                <strong>
                  <font size="2">
                    Customers Maintenance
                  </font>
                </strong>
              </div>
              <p>
              </p>
              <div>
                <font size="1">This is the 
                    Northwind Customer
                    Maintenance Application.
                </font>
              </div>
            </body>
          </iwb:XHTML>
        </iwb:RegionProperties>
      </iwb:Region>

      The keys to this XML are the Region entity and the RegionProperties entity. The Region attributes must be set to match your metadata scope and entity. The RegionProperties must set the name, caption and description. Then within the <iwb.XHTML> element you can put any valid HTML for your region. Refer to Figure 12.)

    4. Close the new Operation window.
  3. Finally we will create a custom Action to call the HTML Operation. To do this, follow the steps below:
    1. Navigate to the Actions node in the new Welcome Entity. NorthwindIBF --> Welcome --> Welcome_View --> Actions.
    2. Double click on the [Add Action…] node. Set the following parameters and leave everything else un-checked:
      • NameShowWelcomeMsg
      • TypeEnterContext
      • Parameters schema – (none)
    3. Click OK, to finish adding the new Action.
    4. Now double click the new ShowWelcomeMsg action to bring up the action designer.
    5. Drag and Drop the new "Northwind.Customer.Welcome" Operation onto the design palette.
    6. Save and publish the metadata.
    7. Test the new action to see if the appropriate metadata is being displayed.

    Note: When you test this action, you do not need to specify any: view locator, input reference or action parameters. The operation that is being called is completely self sufficient.

    Now that we have a good default Entity, View and Region, we can test attaching this schema to a Word document and seeing if it works. I will walk you through the steps for attaching an IBF schema to Word below:

    1. Open up Notepad and paste Listing 5 into the new text file. This is the schema that will initiate an IBF function.
    2. Save the file on your local disk and name it NorthwindIBF.xsd.
    3. Open up a new Word document, so that we can attach the new schema.
    4. In Word click on the "Templates and Add-Ins…" menu, under the "Tools" menu. When the dialog opens click on the "XML Schema" tab. (Refer to Figure 13.) This window lets you manage all of the schemas that you are able to attach to a Word document. We now need to tell Word where the "NorthwindIBF" schema is.
    5. Click on the "Add Schema" button and browse to where you saved the NorthwindIBF.xsd file.
    6. Now you will be able to give this schema an alias. I named this schema, "NorthwindIBF".
    7. Next, select this schema so that it will be attached to this Word document and hit OK.
    8. Once you click OK, you will see the "XML Structure" task pane appear. This pane lets you select entities, from a schema, and add them to your document. You will notice that the "NorthwindsCustomersDocument" element is available to add to the document. (Refer to Figure 14.)
    9. You can now select that element, by clicking on it, and it will automatically drop into the Word document. After you add this element to Word, IBF will automatically initialize and display the default Entity and View, which in our case is the HTML region. (Refer to Figure 15.)

Now that our attached schema works and you have seen how IBF can be initialized from Word, you might be asking yourself; what about passing parameters? IBF supports this, by allowing you to specify attributes, within your elements. These attributes will get passed to the IBF operation, as parameters. The next section will show you how to do this. Save and close the Word document, because we will be adding functionality to it in the next section.

IBF attached schemas – Custom attributes

This part of the walkthrough demonstrates how to pass parameters, from an attached schema, to IBF. This is useful if you need to pass parameters to your IBF operations. In this example, I want to have a CustomerID passed to IBF, from my attached schema, in order to display the appropriate Customer details in the IBF task pane. To accomplish this is not very straightforward. This part took me the longest to figure out. The trick is to understand exactly what is being passed from the attached schema to IBF. Then from there, it is a matter of transforming what is passed into IBF to the properly formatted input the IBF operation expects. You do this transformation using a port that contains the proper XSL.

Note: I found it very handy to have an XSL editor on hand to test out the XSL and make sure that it is correct. I would recommend XML Spy, or Stylus Studio XML professional.

The complete process involves the following six steps:

  1. Create an Operation to call an existing Action.
  2. Create a Port to call the XSL to transform the input.
  3. Create the Transformation Entity that uses the Port.
  4. Create a new View to host a new Action.
  5. Create the Action that the attached schema will call. This action will call the Operation and Transformation listed in steps 1 and 3.
  6. Verify the attached schema is correct, create the Word XML and test the solution.

Step 1

Step 1 will involve creating an Operation that simply executes a pre-existing Action. Since we already have an Action that gets the Customer details and displays a Region, all we have to do is create another Operation that calls this. In coding terminology, this is like creating a method and reusing it in other applications or classes. But instead of code, it's metadata. Below are the steps to create this Operation.

  1. Navigate to the Add Port Metadata element. NorthwindIBF --> Operations --> [Add Operation…].
  2. Double click on the [Add Operation…] to bring up the Add Operation dialog.
  3. Set the following parameters: (Refer to Figure 16.)
    • Name - Att.CallShowCustomerDetails_Action – I am using the prefix Att to denote that this series of entities are related to attached schemas. You can use any prefix you want, if you choose.
    • Entity – (None)
    • Operation TypeOperationExecuteAction. After selecting this type, the appropriate Execute Action properties need to be completed.
    • Reference Schema Xsd.CustomerID
    • Parameter Schema – (None)
    • Output Schema – Nothing to do here.
    • Metadata Scope – NorthwindIBF
    • Entity Customers
    • View Customer_View
    • Action GetCustomerDetails_Action
    • View_Locator Xsd.CustomerID
  4. As you can tell by looking at the parameters in the dialog, this Operation simply points to a specific Action in a metadata scope. By using this type of Operation, you can call any Action, in any other metadata scope, Entity, View, etc.. Click OK to add the new Operation.

Step 2

Step 2, we will create the Port that contains the XSL to transform the incoming XML to the appropriate syntax the Action expects. Below are the steps to create this Port:

  1. Navigate to the Add Port metadata element. NorthwindIBF --> Ports --> [Add Port…].
  2. Double click on the [Add Port…] to bring up the Add Port dialog.
  3. Set the following parameters: (Refer to Figure 17)
    • Name - Att.Xsl.Transform.CustomerID
    • Type – Port File XML
    • Port File XML Properties – Select the Radio button to save the XML data to the metadata file. This will save the XML directly into the metadata. You could also store the XSL in an external file and then reference it.
    • XML – Within the text edit box, copy and paste the following XSL:
      XML
      <xsl:stylesheet version="1.0" 
         xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
         xmlns:iwb=
           "http://schemas.microsoft.com/InformationBridge/2004" 
         xmlns:att="NorthwindIBF">
        <xsl:template match="/">
          <CustomerID xmlns="CustomerID-Data">
            <xsl:attribute name="CustomerID">
              <xsl:value-of select="/att:Customers/@CustomerID">
              </xsl:value-of>
            </xsl:attribute>
          </CustomerID>
        </xsl:template>
      </xsl:stylesheet>

      Let's take a closer look at this XSL. All this XSL does, is take any XML that is passed into it and transform it to the following syntax:

      XML
      <?xml version='1.0' ?>
      <CustomerID 
          xmlns="CustomerID-Data"
          xmlns:iwb=
            "http://schemas.microsoft.com/InformationBridge/2004" 
          xmlns:att="NorthwindIBF" 
          CustomerID=""/>

      This is exactly how IBF needs it, to call the GetCustomerDetails_Action. If you look back, from Part 1 of the article, the web method to get the Customer details expected the CustomerID schema. This schema is what you see above. The difference is that we want to dynamically enter the attribute value for the CustomerID. To do this, we add the <xsl:value-of> and the select attribute. This finds the <Customers CustomerID=""> element and attribute and replaces the value in the CustomerID attribute with the value passed in XML.

      To demonstrate, if you pass in the following XML:

      XML
      <att:Customers CustomerID="LETSS" 
          xmlns:att="NorthwindIBF"/>

      To the following XSL:

      XML
      <xsl:stylesheet version="1.0" 
          xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
          xmlns:iwb=
            "http://schemas.microsoft.com/InformationBridge/2004" 
          xmlns:att="NorthwindIBF">
        <xsl:template match="/">
          <CustomerID xmlns="CustomerID-Data">
            <xsl:attribute name="CustomerID">
              <xsl:value-of select="/att:Customers/@CustomerID">
              </xsl:value-of>
            </xsl:attribute>
          </CustomerID>
        </xsl:template>
      </xsl:stylesheet>

      You will get back the following XML Transformation:

      XML
      <CustomerID 
          xmlns="CustomerID-Data" 
          xmlns:iwb=
            "http://schemas.microsoft.com/InformationBridge/2004" 
          xmlns:att="NorthwindIBF" 
          CustomerID="LETSS"/>

      Notice how the CustomerID is now populated with "LETSS". Click OK to finish the Add port dialog.

Step 3

In this step, we will create the Transformation metadata element, that simply makes a call to the Port. Below are the steps to create this Transformation:

  1. Navigate to the Add Transformation metadata element. NorthwindIBF --> Transformations --> [Add Transformation…].
  2. Double click on the [Add Transformation …] to bring up the Add Transformation dialog.
  3. Set the following parameters: (Refer to Figure 18)
    • Name - Att.Xsl.Transform.CustomerID
    • Type – Transformation XSL
    • Input Schema – (None)
    • Output SchemaMSIBF.Text
    • PortAtt.Xsl.Transform.CustomerID
  4. All we did was create an XSL Transformation entity that called the appropriate Port that contains the XSL. Click OK to finish the Add Transformation dialog.

Step 4

The next two steps are straightforward; they just involve creating a new View and an Action. We have already done these steps before, so I will not elaborate on them. Follow the below steps to add the View:

  1. Navigate to the Add View metadata element. NorthwindIBF --> Entities --> Customers --> Views --> [Add View…].
  2. Double click on the [Add View …] to bring up the Add View dialog.
  3. Set the following parameters:
    • Name - Att.CustomerDetails_View
    • SchemaXsd.CustomerID
  4. Check the option to make this the default view.
  5. Click OK to close the Add View dialog.

Step 5

This step will create the new Action, that calls our new Operation and Transformation. This step ties all the metadata together. Follow the below steps to add and configure the Action:

  1. Within the Att.CustomerDetails_View, double click on the [Add Action…] node.
  2. Set the following parameters and click OK to add the new Action:
    • Name - Att.CustomerDetails_View
    • TypeEnterContext
  3. Double click on the new, Att.CustomerDetails_View, Action to bring up the Action designer.
  4. Drag and Drop the Att.CallShowCustomerDetails_Action Operation onto the Action designer.
  5. When the Transformation instance dialog opens, set the following properties:
    • Data Source – Reference
    • Transformation Instance - Att.Xsl.Transform.CustomerID
  6. Click OK to close the Dialog.
  7. Save the metadata and publish it to the server.

Step 6

The final step is to test the attached schema and make sure it works. To do this, follow the steps below:

  1. Open up the Word file that contains the attached schema we created in the last section.
  2. When the document opens and the IBF task pane appears with the HTML Welcome region, click in between the "NorthwindsCustomersDocument" elements.
  3. Click on the Document Actions menu. This menu is on the top of the IBF task pane. Select the "XML Structure" menu. This will bring back the XML structure view. (Refer to Figure 19.)
  4. In the Choose an element to add to the document section, you will see the CustomerID element. (Refer to Figure 20.) Select this element to add it in between the NorthwindsCustomersDocument elements.
  5. You might have noticed that the IBF pane attempted to process the Action and display the Customer details region. But an error was caused, because we did not specify any CustomerID yet. To do that, right click on the Customers element and select the Attributes option. (Refer to Figure 20.)
  6. On the Attributes For Customers dialog, you will now see the CustomerID attribute. This is because the attached schema contains this attribute, so that it can be added to the document. In the Value field, add the CustomerID for LETSS, then click the Add button. (Refer to Figure 22.)
  7. Click OK to close the dialog.
  8. Now, move your curser in between the Customers element and IBF will initialize the GetCustomerDetails_Action. It should then display the appropriate customer details. If the Customer details region is not displaying at all, then try saving the document, closing it and then reopening it. (Refer to Figure 23.)

That's it! Now we can add as many Customers elements to this document and set different CustomerID attributes. This is a very powerful feature of IBF. You can probably see where you might be able to use it within your applications. To create this, we did not have to write, or compile any code. We simply created some XML/XSL and added it to the IBF metadata repository. Save and close the document. The next section will show you how to automate Office from within the IBF task pane.

Office automation from IBF

In this section, I wanted to demonstrate how you can automate an office application from within the IBF task pane. This is how you can expand the IBF region capabilities so that you can allow users to perform actions from Word. In this exercise, I simply want to insert the Customer name into the Customers element when the user clicks on a button in the IBF task pane. To do this we need to add some code to the Customer details region that the IBF wizard created for us. Follow the steps below to accomplish this:

  1. In Visual Studio, open up the "IBFNorthwind_ControlLib" project, that was created by the IBF region creation wizard.
  2. Open up the CustomerDetails.cs, Windows forms user control.
  3. Make this control longer, so that we can add a button to the bottom.
  4. Add a new button, name it; "Insert Company Name" and then double click on it to create the event code. (Refer to Figure 24.)
  5. Add a reference to the Microsoft Word COM object. This will allow you to work with the Word object model from within Visual Studio.
  6. Add the code in Listing 8. This code creates an object to the Word application and the document. Then it inserts the Company name text into the Word document.
  7. Save and compile the project.
  8. Open back up the word document with the attached schema. Put the curser in between the Customers elements. Once the IBF Customer details region loads, you will see the new "Insert Customer Name" button. Click this button and the company name will be inserted into word, in between the Customers element. (Refer to Figure 25.)

Deployment

This final section will talk a little bit about deployment to the client. To deploy an IBF solution to the client, the user must have the IBF client installed on their system. They also need to have Office 2003. Once IBF is installed on the client, it needs to be configured to point to the appropriate metadata service. To do this, IBF 1.5 has an administration and configuration tool that allows you to set these properties. This tool can be found in the Administration tools folder, on the Start menu. (Refer to Figure 26.)

Once the client has the proper configurations to point to the metadata server, the user needs to install the appropriate smart tag and Windows Forms User Control assemblies from your project. This can be done in several ways. You can create an installation program that will install these assemblies in the GAC, or another location that the IBF metadata can locate. But an easier way is to simply point your IBF ports to a web location where they can be found. Instead of having a hard coded path to a local disk, you could put these assemblies on a publicly available web server, and then point the port metadata to this location.

For example, the Port, "Asm.UI.CustomerDetailsAssembly" references an assembly, CustomerDetailsAssembly.dll, located on the "C" Drive on my local computer. I could copy this assembly to my web services directory and then change this Port to point to that web address. So instead of having a reference like: C:\Projects\CustomerDetailsAssembly.dll, you would have a reference like: http://myserver.com/ibf/customers/CustomerDetailsAssembly.dll.

Now when a user opens up your document, that contains an attached schema, this assembly will automatically be downloaded and installed on the users' machine.

Note: Your assembly must be signed and trusted on the users' machine. To do this, you can have an IT administrator create a machine policy that will trust your signed assemblies.

Summary

To wrap up this article, we walked through several advanced topics of IBF, including: Custom Smart Tag menus, Search regions, Attached schemas and Deployments. The purpose of these articles was to show you exactly how to accomplish these tasks in IBF 1.5. I believe that this is a great technology that really shows the power of integrating office applications, web services, metadata, XML/XSL and of course .NET. I hope that this article helps you out and that you can now create a complete IBF solution on your own.

References

IBF Web SiteInformation Bridge Framework
Smart Tag SDKOffice 2003: Smart Tag Software Development Kit (SDK)
Office ZealotOffice Zealot
SQL Northwind Database

Northwind and pubs Sample Databases

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
United States United States
Tom McCartan, Vice President - Digital Infuzion

Mr. McCartan has been an industry leader and pioneer of architecting Microsoft’s .NET solutions since early 2000. He is an expert software development specialist and a Microsoft Certified Applications Developer with over ten years of experience in software architecting, developing, implementing and supporting large scale enterprise systems. Tom has led several large scale software development departments for fortune 500 companies such as ACNeilsen, NFO Healthcare, Ajilon and Information Resources. He is an expert on .NET architecture, Web Services, Mobile applications development, BizTalk, SharePoint, and numerous other Microsoft technologies.

Comments and Discussions

 
Generalstep menu Pin
Pipo8427-Feb-08 22:30
Pipo8427-Feb-08 22:30 
QuestionAny good Outlook Examples? Pin
GRChauvin3-Jan-06 6:22
GRChauvin3-Jan-06 6:22 
AnswerRe: Any good Outlook Examples? Pin
Gerhard Grahle24-Feb-06 4:15
Gerhard Grahle24-Feb-06 4:15 
QuestionAny good Outlook Examples? Pin
GRChauvin3-Jan-06 6:21
GRChauvin3-Jan-06 6:21 
Generalproblem in deployment at client machine. Pin
roopaananda5-Jul-05 20:17
roopaananda5-Jul-05 20:17 
GeneralRe: problem in deployment at client machine. Pin
Anonymous18-Sep-05 22:29
Anonymous18-Sep-05 22:29 
Generalclient installation clarification Pin
roopaananda1-Jul-05 2:04
roopaananda1-Jul-05 2:04 
GeneralRe: client installation clarification Pin
roopaananda5-Jul-05 20:07
roopaananda5-Jul-05 20:07 
GeneralNew IBF Book Released Pin
BlueVision15-Apr-05 9:44
BlueVision15-Apr-05 9:44 
GeneralRe: New IBF Book Released Pin
Paul Selormey15-Apr-05 10:17
Paul Selormey15-Apr-05 10:17 
GeneralRe: New IBF Book Released Pin
BlueVision15-Apr-05 10:28
BlueVision15-Apr-05 10:28 
GeneralRe: New IBF Book Released Pin
Paul Selormey15-Apr-05 11:39
Paul Selormey15-Apr-05 11:39 
GeneralWord Connector Pin
Lucifer797-Apr-05 4:15
Lucifer797-Apr-05 4:15 
GeneralRe: Word Connector Pin
Tom McCartan7-Apr-05 4:38
Tom McCartan7-Apr-05 4:38 
GeneralRe: Word Connector Pin
Lucifer797-Apr-05 4:47
Lucifer797-Apr-05 4:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.