Why Isn’t InfoPath Retrieving All SharePoint List Items?
Posted by DevExpert on February 5th, 2009
InfoPath and SharePoint make a great team when it comes to creating simple electronic forms. It’s relatively simple to create a robust data-entry form, and is easy to submit an InfoPath form to a form library. It’s even simple to pull in data that is stored in a SharePoint list. However, what you may not realize is if a data connection is configured to retrieve SharePoint list items, it only retrieves the items from the first page of the default view. What does that mean? Let’s say you have a SharePoint list that contains 500 items, and your default view (the view that is loaded whenever you visit the list) is set to only show 100 items at a time (like it is by default). When InfoPath executes its query to retrieve the list items, it will only retrieve 100 items. More specifically, it will only retrieve the first 100 items. So, if you happen to change the default view’s criteria or sort order, then InfoPath will be pulling in a different set of data! Don’t believe me? Let’s take a look…
To begin, I created a custom list in SharePoint named Widgets, and added 100 items to it. Next, I created a new view named Sample View in the list, and set that as the list’s default view:
Next, I set the Item Limit to only 7 items per page: ![]()
After clicking OK and saving the view, whenever I access my list I’m presenting with the first 7 items in the list:
Now that I have a data source, I create my InfoPath form and set up a data connection to retrieve data from the Widgets list. I added the results of the data source to a repeating table, and whenever I run my form, I am only presented with the first 7 items (told ya!):
Just to make sure this is the actual behavior and I’m not just hallucinating after a long day, I modified the view and changed the sort order to sort by Title in descending order, and changed the item limit to display 12 items at a time:
When I open the form again and the data connection is executed, it retrieves the first 12 items after the new sort has been applied!:
One would think that there would be some type of configuration option in the data connection wizard that asks to retrieve all items, or the results from a specific view, but there isn’t. If you do need to retrieve all list items, it’s imperative that your list’s default view displays them all, or consider a different data retrieval method such as the built-in or custom web services.
There’s even a KB article that says this behavior is by design: http://support.microsoft.com/kb/892954
March 17th, 2009 at 8:17 am
Wow, I just came across this issue myself when creating a form. Pretty bad! You’d think the data connection would at least allow you to pick a view.
March 19th, 2009 at 9:38 am
Is the same true for forms rendered in forms services? It seems not to be from what I am seeing.
March 24th, 2009 at 6:56 pm
Craig,
Well what do ya know — I just tried it and you’re right, it doesn’t seem to have the same behavior when published as a browser-enabled form. Gotta love the consistency
Great job on finding this!! Thanks!
February 16th, 2010 at 7:51 pm
I just finished getting burned for a couple hours on this one! I went over my form, data source and filters with a fine tooth comb. I thought something evil may be cached, and cleared all of that up.
Finally, I had the sense to remove the filters from some of my queries that populated combo controls and observed their values. Then it hit me like a ton of bricks.
It was the 100 item limitation on the default view! Nothing like spending a lot of time questioning your work when the form is working just like it should.
February 17th, 2010 at 6:05 am
One thing, i have added a new item to the list from sharepoint and rearranged the order to be pulled onto an online form and the data connection is pulling through the list fine but not in the right order. It just adds the new item at the bottom???