Lab 3: Integrating InfoPath 2007 with the Data Connection Library

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

Learn how to use Universal Data Connection (UDC) files in a Data Connection Library (DCL) to provide data connection settings to Microsoft Office InfoPath 2007 form templates for use in both client and server forms. (5 printed pages)

February 2007

**Applies to:**Microsoft Office InfoPath 2007

Contents

  • Lab Objectives

  • Lab Setup and Requirements

  • Scenario

  • Exercises

  • Conclusion

  • Additional Resources

Download: InfoPath 2007 Sample: Training Labs.

Lab Objectives

In this lab, you will learn how to do the following:

  • Create a data connection library on Microsoft Office SharePoint Server 2007

  • Create and modify a Universal Data Connection (UDC) file to specify a SharePoint list data connection

  • Use Microsoft Office InfoPath 2007 to design a form that uses these settings from a data connection library

  • Set up a drop-down list box to show only unique values from a data connection

Lab Setup and Requirements

To complete this lab, you must have the following:

  • Microsoft Office InfoPath 2007

  • Access to a Microsoft Office SharePoint Server 2007 or Microsoft Office Forms Server 2007 server as a Farm Administrator

You must have Office InfoPath 2007 installed on a client computer and InfoPath Forms Services installed on a server computer. Both applications can be installed on the same computer.

Scenario

Jane at Contoso Pharmaceuticals wants to create a simple form to enable the sales team to submit feedback about the sales events announcements located on the team's SharePoint Server site.

Exercises

Creating a Data Connection Library

Follow these steps to create a data connection library in a site collection so that you have a place to put the shared data connection settings file.

To create a data connection library

  1. Open the root site of your SharePoint server in a Web browser.

  2. On the Quick Launch bar, click Documents.

  3. On the All Content page, click Create.

  4. On the Create page click Data Connection Library.

  5. Type DCLLab for the library name, leave all other defaults, and then click Create.

Creating a Connection Settings File

The Universal Data Connection (UDC) file will be used by InfoPath to determine where to get data for an announcement list in the form that you will create later.

To modify an existing UDC file to point to the Announcements list on your site

  1. Using a text editor or an XML editor, open the file SharePoint List Test File.udcx from C:\2007 Office System Developer Resources\Code Samples\InfoPath2007SampleTrainingLabs.

    You will see the following code.

    <udc:SelectCommand Type="">
        <udc:ListId>{A725A4D1-EEC7-4453-84AB-635847258CE9}</udc:ListId>
        <udc:WebUrl>http://myserver/</udc:WebUrl>
    </udc:SelectCommand>
    
  2. Replace http://myserver with the fully-qualified URL to the root SharePoint Server site where you created the data connection library.

  3. Replace ListId with the list ID of the Announcements list on your SharePoint Server site by opening the root site, and performing the following steps 4-7.

  4. From the Site Actions menu, click Site Settings, and then click Modify All Site Settings.

  5. Click Site Libraries and Lists in the Site Administration section.

  6. Click the Customize Announcements link.

  7. In the browser's address bar, copy the GUID number and surrounding braces, and paste this as the ListId value, for example, http://localhost/MyTeamSite/_layouts/listedit.aspx?List={A725A4D1-EEC7-4453-84AB-635847258CE9}.

  8. Save the file as DCLLab.

  9. Click Announcements in the breadcrumb bar to go back to the Announcements list.

  10. Select New Item from the New button to add an announcement.

  11. Enter various announcements for testing, including some duplicate announcements.

To upload the UDC file to the data connection library

  1. Open a Web browser and navigate to the DCLLab data connection library you created in the previous exercise.

  2. Click Upload.

  3. On the Upload Document page, click Browse and navigate to the UDC file you created in the previous exercise.

  4. Click OK.

  5. On the Properties page, verify that the Description for your file is displayed, its purpose is ReadOnly, its ConnectionType is SharePoint List, and the content type is Universal Data Connection File, as shown in Figure 1.

    Figure 1. Verifying the Properties page of a UDC file

    Properties Page of UDC File

  6. Click Save.

  7. Click the UDC file drop-down menu, and then click Approve/Reject to approve the file for use.

To design a form template that references the UDC file

  1. Start Office InfoPath 2007.

  2. In the Getting Started dialog box, click Design a Form Template.

  3. Select Blank, and then click OK.

  4. On the Tools menu, click Data Connections.

  5. In the Data Connections dialog box, click Add.

  6. On the first page of the Data Connection Wizard, select Search for connections on a Microsoft Office SharePoint Server, and then click Next.

  7. Click Manage Sites.

  8. In the Manage Sites dialog box, click Add.

  9. In the Site Details dialog box, in the first field, type the path to the site that contains your data connection library (for example, http://localhost/MyTeamSite).

  10. (Optional) In the second field, type a display name to identify this site.

  11. Click OK, and then click Close.

  12. In the Site list, select the site you defined.

  13. Expand the entry for your data connection library, select the UDC file you uploaded, and then click Next.

  14. Choose the following columns to include in the list, and then click Next.

    • Title

    • Modified

  15. Select the check box to cache a copy of the current data in the form for offline users.

    Because Announcements data is not likely to change frequently, this will ensure that users always have the data available, without significant risk of the data being out of date.

  16. Click Next twice, click Finish, and then click Close.

    Next, add some text and controls to the form so it looks similar to the following form template.

    Figure 2. Creating a simple form to test the data connection

    Create a Simple Announcements Form

  17. Double-click the drop-down list box to display the control's properties.

  18. Under the list box entries, select Look up values from an external data source.

  19. Select the Announcements list data connection you added in the previous exercise from the Data source list.

  20. Click the button next to Entries.

  21. Expand nodes in the field chooser and select Announcements, then click OK.

  22. Click the button next to the Value field.

  23. Expand the Announcements node, and select Title, as shown in the following Figure 3.

    Figure 3. Selecting the field to show in the drop-down list

    Select a Field

  24. Click OK.

  25. Select the Show only entries with unique display names check box, and then click OK.

  26. Save the form.

To test the form

  1. On the File menu, click Preview Form.

  2. Open the drop-down list box and note that it has been populated from the Announcements list.

    NoteNote

    The entries that appear more than once have been filtered out so that only unique entries are shown in the list.

  3. Close the preview window and save the form.

Conclusion

In these exercises, you learned how to create a data connection library on an Office SharePoint Server 2007 running InfoPath Forms Services, and how to create a Universal Data Connection file to define a SharePoint List connection. You also learned how to design a form that takes its data connection settings from the UDC file, and how to set a drop-down list box to only show unique values from a data connection.

To learn how to enable digital signatures in an InfoPath form so that users can sign the form in InfoPath or in Internet Explorer, see Lab 4: Enabling Digital Signatures in InfoPath 2007 Form Templates.

Additional Resources

For more information about developing with InfoPath, see the following resources: