Receiving Data from SharePoint Lists and Business Connectivity Services
Adding a SharePoint List Data Connection
In the following exercise, you will add a control on an existing form so that the form can receive information from a SharePoint list.
In the scenario behind this exercise, you have had a request to add another field of information to the Flight Delay form to capture the name of the flight’s captain. One effective way to handle this requirement might be to add a SharePoint receive data connection because you already have a list of pilots’ names in SharePoint.
Publish the Flight Delay form to a form library in SharePoint (if it is not already).
Create a new SharePoint custom list in the same site. Call the list Pilot Names.
In the list, create one text column named Pilot Name.
On the ribbon, on the List tab, click the List Settings button. Set the Require that this column contains information option of the Title column to No.
Enter the following seven pilot names in your list:
Switch back to the Flight Delay form in InfoPath Designer. In the table on the top part of the form, right-click in the area below the Reason for Delay field.
In the label area, add the text Pilot Name, and then insert a Drop-Down List Box control. In the control’s properties, rename it PilotName.
On the ribbon, on the Data tab, click the From SharePoint List button to create a receive data connection on your form.
The Data Connection Wizard opens.
Provide the required information in the wizard to add the Pilot Names list you added in step 2. On the third page of the wizard, select the check box to add the Pilot Name field.
For the remainder of the wizard pages, accept the defaults, and then click Finish.
Now you need to connect the SharePoint list receive to the Drop-Down List Box control.
In the properties for the Pilot Name Drop-Down List Box control, select Get choices from an external data source and ensure that Pilot Names is selected, as shown in the following screenshot.
Click OK, and then press F5 to preview the form.
You should now have the information from the SharePoint list available in your Pilot Name field.
Use the Quick Publish button to update the form library with your new and improved form.
Now, anytime a new pilot name is added in the SharePoint list, your form will automatically display the name in the Drop-Down List Box control.