Hi, my name is Joey Wiggs and I’m a developer on the InfoPath team. In InfoPath 2010, one of the ways in which we've improved our integration with SharePoint Server 2010 is by providing richer capabilities for connecting to and getting data from SharePoint lists. In this post, I will compare SharePoint list data connections in InfoPath 2007 and InfoPath 2010, and discuss the benefits of using the new 2010 data connection type. I will also outline the steps required to upgrade your InfoPath 2007 SharePoint list data connections to the new and improved version.
Let’s start by looking at a scenario when you would use a SharePoint list data connection in an InfoPath form.
In Microsoft, when employees run into technical issues, they log a help ticket by filling out an InfoPath form. They start filling out the form by selecting an Problem category from a dropdown list. We could store the category names inside the form but that means that whenever a category is added, deleted or renamed, the form will need to be updated.
Instead, we can store the Category names in a separate SharePoint list and pull this information into the form when users are filling it out. We can do this by adding a SharePoint list data connection to the form. The benefit of using a data connection is that the data can be maintained separately in a single location and the form will always pull in the most up to date information from that location.
For example: By setting the “Modified by” query field to the current user (using the username() function), the query will return only those list items that were modified by the current user.
In previous releases, the number of items returned and the sorting order of said items were determined by the default view for the list in SharePoint. To work around this limitation, form designers had to go to the list settings page in SharePoint and modify the default list view to get the data they wanted into their forms. That’s no longer the case! The new 2010 list data connection will return all of the items in the list, regardless of the default view’s settings. You can also sort the incoming data by a particular field in the data connection wizard when creating a new connection, or modifying an existing one.
The new list features are supported in InfoPath 2010 filler and browser forms only, so if you want to use the new connection in your existing InfoPath 2007 form you will need to upgrade your existing forms to InfoPath 2010. However, once upgraded, InfoPath 2007 clients will not be able to open the form.
To upgrade the data connection, form designers must complete the following steps:
For each list data connection that retrieves data in your form, you will need to select it in the data connections dialog and press the “Convert to Current Version” button. You will be prompted if you want to continue. After conversion, you will see an information bar when that connection is selected stating that the data connection is incompatible with the current version of your form. That’s okay; we’ll be upgrading the form to the required version later.
After converting a data connection, you’ll need to rebind your controls and fix any field or XPath references inside rules and code. When rebinding, you’ll need to rebind the repeating sections to the d:SharePointListItem_RW group, then rebind the controls inside the repeating sections to the correct fields. You can rebind a control by selecting it, then right-clicking and choosing “Change Binding”. This brings up a dialog where you can choose what field or group to bind the control to.
Fixing your rules consists of finding the rule and updating any field references. Field references from the old adapter will look something like “@Title” after you convert your 2007 adapter to 2010. Select the reference, pick the field you want the rule to reference and away you go.
Once you’ve saved your form, you will be able to avail of all the capabilities of the new 2010 SharePoint list data connection. At any time, you can use the data connections dialog to modify the newly upgraded connection, to add new field types, or to use the sort by functionality. You can also set the value of query fields using rules in your form.
In 2010 data connection it is not bind to the default view but how can we achieve this in 2007..i have folders in my form library and whenever i make a data connection it just seems to get data when i am the root level of the library..when i go inside a folder the data connection does not work...any idea how can this can be achieved in 2007 infopath.
Folders in document libraries are an interesting case, as the folder itself is just another item in the document library. If you try navigating to a document library folder directly in a browser (ie: http://contoso/MyLibrary/MyFolder), you’ll get a 404 Not Found, which is why making a data connection directly to the folder will not work: it doesn’t actually exist. Without the ability to override the default view, what you want is unfortunately not possible in InfoPath 2007. However, you can get all documents using the new SharePoint List connection in InfoPath 2010 thanks to the ability to override the default view
This will open up a lot of opportunities for further integrating SharePoint and infopath.
I am running SharePoint Server RTM 2010 and InfoPath 2010. When I try to create a new ShaerPoint List Form I get the error "This feature requires SharePoint Server 2010 or greater with InfoPath Forms Services enabled. I have configured InfoPath Forms services in the SP admin console. Do you know where I can go to confirm that InfoPath Forms Services is indeed running.
I just used your article the other day building a prototype for a client. A great addendum to this article would be going more in-depth on query fields for the SharePoint data source, including more screen shots, as it is a bit tricky setting these up the first time.
Thanks for a great article.
Thanks for your comments. We will look into creating another post soon about SharePoint data connection query fields.
Joey, if i create a SP List connection using IP 2010, can my users with IP 2007 use the form?
Using InfoPath 2010 I want to create a web-based form (containing repeating sections) to submit to a SharePoint list. The majority of the fields do not need to repeat.
If I place the non-repeating fields outside the repeating section then have multiple entries in the repeating section I receive an error when trying to submit.
Is there anyway to have a non-repeating section and repeating section and still be able to submit to the list?
SharePoint lists can’t actually store repeating data in a single item, so check out the Using repeating data in list forms section from our Comparing SharePoint List and Form Library Forms article for some workarounds.
You started to talk about how to set up a form for Problem Tracking, so that the user would be able to enter a problem and provide updates, but did not explain how this is done. I have been able to add items to my SharePoint list, but have not been able to update the list. Is that possible?
Need assistance. I have need to grab data from a ShrePoint 2010 List into a dialog box field in an infopath 2010 form. When I try to make a Data Connection, it fails when placing the web site URL. "Operation cannot be completed". Am I missing a step ? Is there a feature that enables InfoPath or the SharePoint server to share list data ?
How can i programaticaly show the quick parts in word document using infopath sahre point and ms word
Is Filtering ability work for External COntent Type lists as well?
Great article, I has a question about the data that is pulled from a SharePoint list. will that data stay in the older submitted forms if the listed is edited and updated with different values.
Hi, if i wanna to get data from form library and save it in custom list ??
How can i do that