Microsoft InfoPath 2010
The official blog of the Microsoft InfoPath team

Populating form data from SharePoint List Views

Populating form data from SharePoint List Views

Rate This

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.

First, let’s get the URL:

1. Navigate to the SharePoint site that contains the list, for example:
2. Go to “Modify settings and columns”
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.


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.


Some tricks:
1. When you’re in “Modify settings and columns,” if you click on one of the views in the list at the bottom, you should note that the URL is “enriched” with &View={ANOTHER_GUID}.  If you would prefer to use the columns from that view, you should similarly enhance the URL you use above.
2. You can also use the url to filter data rows based on column values. For example:


Note: be sure to remove the “ows_” from the beginning of the FilterField ID.


With this filter, the XML file returned will be filtered to only display those projects that have been approved.  Without the green portion, you would see all the projects.


In order to populate other fields with data from WSS, you create the secondary data source just like above, then in form code or script, you can use GetDOM(“dataSource”) and walk the DOM normally, updating the main DOM as appropriate.


Ed Essey
Program Manager

Leave a Comment
  • Please add 4 and 8 and type the answer here:
  • Post
  • Hi

    i am working with this SharePoint URL protocol, its quite good. But my question is can i get list item versions using this URL protocol concept and also can i apply filter operator, for example

    Example: http://contoso/sites/_vti_bin/owssvr.dll?Cmd=Display&List={115BC7B7-0A82-403E-9327-F3C73E6D37F3}&XMLDATA=TRUE&FilterField1=ID&FilterValue1=2&FilterOp1=Geq

    Is there a way to use filter operator in URL protocol.


  • I got a question I'm hoping someone can answer.  I've used this URL protocol successfully many time in my SharePoint 2007 environment, however, when I try to replicate in my SharePoint 2010 Dev Environment I get a file not found error when I run my form with the code.  I believe the issue could be tied to the fact that when I type the url and put in the browser, it prompts me to save rather than just displaying in the browser.  Does anyone have a solution for this?

  • Update: I figured out what the issue was with my SP 2010 error.  For My Filter Field Value, I was using a field name with a space in it.  To get it to work, I had to click on the field and get the actual field name and place it in my string and it worked.

  • Hi,

    I tried modifying the XSL for string;# issue in the dropdownlist items, but if i add substring-after() and Preview the form, dropdown look ok, but when i try to publish and upload the .xsn on my sharepoint server it gives me - 'Unknown errror' while trying to upload the form. Any idea what's causing that?

    - PB

  • I need to have cascading dropdowns in my infopath form.   My question is how to I select from a dropdown and filter the data in the second list using c# code? I would like to use the changed event to drive the retrieval of the second list and then bind back to the dropdown. This is a very customized form. I have attempted this using the filters on the dropdowns but it does not work in the basic template for an unknown reason.

  • Hi,

      Good article. Now i am working on infopath forms in sharepoint. I want to print the infopath forms stored in the sharepoint as .xml files using C# and aspx pages of wsp project programatically. Can you have any idea about it? Waiting for the reply .......  Thank you....

  • I saw a reference to multi-line SharePoint List columnns below.  I'm trying to pull data from a SharePoint Custom List into my InfoPath form.  For some reason, it won't allow me to Add the multi-line columns that are in the list.  The other types of fields came in (Single Line of Text, Choice), but not the Multiple Lines of Text Column.  I re-established the Data Connection, but still nothing.  Thoughts?

  • Does this work in Infopath 2007.  I thought I could set up a secondary data connection.  It allows me to set it up initialy but when I try to modify it or use in the form. It tells me that I can't connect. But I have the SharePoint list open in my browser so I'm obviously able to connect.

  • I have a travel request form, and I created a list in sharepoint with profiles containing preferences of the member who will fill the form. I want to retrieve these preferences and fill them in the correct fields depending on the user.

    How can I do that?

    Please help

  • Hi Luis,

    Here is an overview of the steps you will need to take assuming you are using InfoPath and SharePoint 2010:

    - Create a "Receive" data connection to your SharePoint list but be sure to uncheck the option: "Automatically retrieve data when the form loads" on the last screen of the Data Connection Wizard. We don't want the form to download all the data right now.

    - On the Data tab of the Ribbon, click the Form Load button - this will add a Rule to the Form Load event

    - Add the following actions:

        - Set a field's value

             - Field: The query field from your list connection that uniquely identifies the member (not sure if you know this when the form opens)

             - Value: the member name (or ID, etc.)

        - Query for Data

             - Data Connection: select your SharePoint list connection

    So at this point, what we have done is query for the one member record that matches the member you entered above. Again, if you don't know this at the time the form loads then you can use a Rule on, say, a button to do the same thing. Now, for the rest of the Rule actions:

        - Set a field's value:

             - Field: One of the fields in your main data source that you want to fill with data from your list

             - Value: The corresponding field from the "data fields" of your SharePoint list data connection

        - Set a field's value - repeat the above step for each of the fields you want to fill

    A few things to consider:

    - If you don't know the member ID, name, etc. when the form is opened (in other words, someone would be entering that information) then you will need to use a Rule on a button or the text box where they enter the member name, ID, etc.

    - If there is no way to uniquely identify the member in your list (i.e. member name or member number, something like that) and you are going to be returning multiple rows of data then the only way to populate that data will be using code.


  • I am having an interesting issue with this.  I am setting up this connection for an Infopath 2010 form.   As long as I put the guid in without the {}'s it allows me to set it up.  

    As soon as I put the guid between the {} it tells me the internet address is not valid.

    Any suggestions?   I suspect that not having it in the {} is causing another issue.


  • Dropdown changed event woking fine in Infopath preview, when I published in Sharepoint server 2010 the event is not firing

  • Hi Vinod,

    As a quick test, try this:

    - Open the XSN in Design View

    - Right-click on the dropdown box and choose Properties

    - Select the Browser tab

    - Change the Postback setting to: Always

    - Save the changes, re-publish and test

    Any change in behavior?


  • Hi

    I am trying to achieve an alphabetically sorted dropdown list box in Infopath 2007 (with SP2007). My form needs to be browser-enabled.

    I have folloed Ed Essey's original guidance but have run into the same problem that Scott, Gertjan and Joel have experienced, i.e, my dropdown list is working in Infopath/Preview, but does not work when I publish to website. When I try to load the form in the browser it shows an iInfopath Forms Services' error - "There has been an error while processing the form" and the options are to Start Over (with a new form) or Continue (with existing form). If I continue the dropdown is empty whereas rest of form is fine as before. The error details is "An error occurred accessing a data source. An entry has been added to the Windows event log of the server.  Log ID:5566"

    Did anyone find a solution to this error?

    Thanks, Amanda

  • In response to my own query above (dated 16th Feb). I searched for the 5566 error and found the article

    Implementing Method 1 fixed the problem for me and now my list box is sorted alphabetically :)

Page 6 of 8 (110 items) «45678