This was a great find that helped resolve a frustrating way that IP integrates SP lists. Unfortunately, you can't specify (or IP doesn't listen to) a view for presenting a SharePoint list within an IP form. This means, for example, that you can't show an alphabetized list of items within an IP form as the results are presented in a sort order based on the list item ID.
Introduction
The SharePoint list data connection in InfoPath is a great declarative way to bring in data from a SharePoint list, but it does have some limitations. For those willing to put in a little extra effort, there’s much more that can be done with SharePoint lists: you can bind to views based on these lists. Here are the steps for creating the connection to a list view.
Gettings Started: Returning the Results from a List
First, let’s get the URL:
1. Navigate to the SharePoint site that contains the list, for example:
http://contoso/sites/sales/Sales%20Contacts/Forms/AllItems.aspx2. Go to “Settings -> List Settings”
3. Copy the List={GUID} portion of the URL and paste this into a buffer like a Notepad window.
4. In Notepad, create the following URL (the blue portion us taken from the step 1 URL, and the red portion must be added.
http://contoso/sites/sales/_vti_bin/owssvr.dll?Cmd=Display&List=GUID&XMLDATA=TRUE
This will return an xml file that can be used in an XML file data connection, as if it came from a file system. After this, you can use the URL as the location of an XML data file when creating a data connection.
Two caveats:
- Form users must have read access to the SharePoint list.
- During creation of the data connection, do not include the file in the form template, as it should be dynamically generated from the SharePoint list.
Next Step: Specifying the List View
Now, let's grab the List View GUID and include it:
1. Navigate to the list and specifically the view you wish to use.
2. Go to: "View --> Modify this View"
3. Copy the View={GUID} portion of the URL and add it to the URL you created above:
http://contoso/sites/sales/_vti_bin/owssvr.dll?Cmd=Display&List=GUID&XMLDATA=TRUE&View=OTHER-GUID