Populate a Control from a List
InfoPath forms can retrieve data from various types of data sources, including SharePoint lists. InfoPath's access to lists is read-only; it can't directly modify items in a list. InfoPath refers to this type of access as a secondary data source. In InfoPath, primary data source refers to where the form data is stored.
Secondary data sources can populate controls, such as drop-down lists, and they can be used to create reports (or views) of lists from SharePoint. The major steps to populating controls from a SharePoint list are:
Create a data connection to the list.
Add controls and bind their values to list fields.
Add filters to display the appropriate data.
The following sections demonstrate these steps using a list on my site that contains InfoPath programming samples categorized by language.
Creating a Data Connection
To create a data connection from an InfoPath form to a SharePoint list:
Design a new, blank form and choose Tools → Data Connections → Add. InfoPath starts the Data Connection Wizard.
Enter the settings in Table 10-5 and click Close when done.
Table 10-5. Data Connection Wizard settings
At Wizard step | Do this | And click... |
---|---|---|
1 | Select Receive data | Next |
2 | Select SharePoint library or list | Next |
3 | Next | |
4 | Select the InfoPath Code Samples list | Next |
5 | Select ID, Title, Language, Example, and Description fields | Next |
6 | Deselect "Store a copy of the data in the form template" | Next |
7 | Select "Automatically retrieve data when form is opened" ... |
Get Essential SharePoint 2007, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.