Querying the Sharepoint List C #

InfoPath 2007: Missing items when querying from a SharePoint list

A common stumbling block with InfoPath 2007 occurs when querying a SharePoint list or library. The query only delivers the elements that the standard view of the SharePoint list shows and only within the specified entry limit (Item Limit). The behavior can also be reproduced under InfoPath 2010 by selecting an InfoPath 2007 form template during creation or in the form options (compatibility).

For demonstration purposes I created a SharePoint list “Sports” with 6 elements.

Now I change the entry limit to 3 elements in the standard view.

And then query the SharePoint list with an InfoPath 2007 form.

As you can see, only the first three items are returned.

The first approach is very obvious. You adapt the standard view of the SharePoint list so that all required elements are displayed. However, this approach is often not applicable in practice because customers have configured a certain standard view for the respective lists and do not want to see all elements unfiltered.

The second approach is to create a new list view and then click that directly above owssvr.dll query. This is an RPC function that has been supplied with SharePoint since version 1.

The stake is deprecated on the part of Microsoft and use is at your own risk!

You need the guid of the list and the newly created view. This information can easily be copied from the address bar of the browser when you are on the page Edit view is located.

In my example I get:

List =% 7BBD3F8712% 2D79AE% 2D4990% 2D8074% 2D692C359D90B1% 7D

View =% 7B16B53ACD% 2D44B1% 2D48B3% 2D8F07% 2DF3B46AF27F58% 7D

From this you build the following URL:
http: //WebSiteUrl/_vti_bin/owssvr.dll? Cmd = Display & List = {GUID} & View = {ViewGUID} & XMLDATA = TRUE & noredirect = true

In my example:

http: //hansevis14/sites/spielwiese/_vti_bin/owssvr.dll? Cmd = Display & amp; List =% 7BBD3F8712% 2D79AE% 2D4990% 2D8074% 2D692C359D90B1% 7D & amp; View =% 7B16B53ACD% 2D44B1% 2DF467% 2DF58; XMLDATA = TRUE & amp; noredirect = true

Now add a new data connection in InfoPath and choose the source XML document

And enter the url generated above as the storage location

On the next page you choose Access the data from the specified location out


In the newly created data connection, you can then select the columns as fields that you have selected in the view for display.