Using Business Data Catalog Actions to Pass Parameters to InfoPath 2007 Browser Forms
Summary: Learn how to use Business Data Catalog actions to pass parameters to Microsoft Office InfoPath 2007 browser forms.
Applies to: 2007 Microsoft Office System, Microsoft Office InfoPath 2007, Microsoft Office SharePoint Server 2007
David Gerhardt, 3Sharp
April 2007
You can build forms with Microsoft Office InfoPath 2007 that run both in InfoPath 2007 and in a Web browser. For browser scenarios, you can integrate with the Business Data Catalog in Microsoft Office SharePoint Server 2007 by having a custom action pass a parameter value to form files. Whether you pass a parameter to a form file in InfoPath 2007 or the Web browser, first you need to update the form template's Loading event. The LoadingEventArgs class of the Loading event provides the InputParameters property. This property gets an IDictionary object, which contains any input parameters that are specified in the URL that is used to start a form file. For this scenario, use the status report sample that comes with InfoPath 2007 to retrieve a parameter value passed in a browser URL. Program the Loading Event To add the Loading event stub to your form code file, on the Tools menu, point to Programming, and then click Loading Event. Next, use the TryGetValue method of the IDictionary object that was returned by the InputParameters property to retrieve a parameter value. Then, use the SetValue method on an XPathNavigator object to set the corresponding node value in the form file. The following example sets the Project box to the value of the CustomerID parameter that was passed in the URL that was used to start the form. The Project box is bound to the projectName node in the data source.
Note You can set the programming language to Visual Basic or C# before you add event stubs to the form code file. To make such a change, on the Tools menu, point to Form Options, click the Programming category, and then set the Form template code language list value accordingly. Deploy the Form Template The form template uses managed code for a browser scenario. Therefore, an administrator must deploy it. First, you need to publish the form template to a network share. To publish the form template to a network share
After the form template is published to a network share, a server administrator then uploads that form template to InfoPath Forms Services and activates it to a specific Windows SharePoint Services 3.0 site collection. To upload a form template to InfoPath Forms Services and activate the template to a specific site collection
Create the Custom Business Data Catalog Action You must update the Business Data Catalog metadata file to include a custom action. For this scenario, you can use the metadata file from the Visual How To article titled Creating Business Data Catalog Entities in SharePoint Server 2007. The following example adds a custom action to the existing Customer entity (before the </Entity> end tag) that starts the status report form in the Web browser with a CustomerID parameter. Note You need to replace the URL_to_WebApplication in the Url attribute with the actual URL for the Web application.
Note Make sure you increment the Version attribute value in the LobSystem element and save the metadata file before uploading it into the Business Data Catalog shared service. Upload the Metadata File into the Business Data Catalog Shared Service After the metadata file is updated, navigate to the Business Data Catalog Applications page in Central Administration and import the new application definition. To import the new application definition
Add a Business Data List Web Part and Invoke the Status Report Action To test your changes, add a Business Data List Web part to any site in your SharePoint Server 2007 installation and then invoke the Status Report action for one of the customers. To add a Business Data List Web part and then invoke the Status Report
Figure 1. Invoking the Status Report action With InfoPath 2007, you can build forms that accept parameters from either the command line or a browser URL. In the latter case, you can integrate with the Business Data Catalog by using a custom action to pass a parameter value to a browser form file. To support a browser form solution that integrates with a custom Business Data Catalog action, you need to do the following:
|
Length: 09:08 | Size: 9.56 MB | Type: WMV file |