Populating an Infopath dropdown using a specific Sharepoint list view

Published on Author peter.stilgoe5 Comments

If you have a Sharepoint list containing multiple views, one view shows all approved items and another view shows all items that are pending approval. You have an Infopath form where you have a dropdown control that you want to be populated with only ‘Approved’ list items from your Sharepoint list.

If you create your Infopath data connection & copy the URL to this list view as your source you will notice it still returns ALL items as opposed to your filtered view listing only the approved items.

The way round this is to create you data connection using an XML source, use this link to find out how to view your list data as XML and get the source URL – http://www.petestilgoe.com/2009/11/converting-a-sharepoint-list-into-xml/

Now you need to expand on this & add the particular view to the url to make the data connection get the filtered data for you.

Currently your URL looks something like this:
/_vti_bin/owssvr.dll?Cmd=Display&List={GUID}&XMLDATA=TRUE&noredirect=true

1) Now in your Sharepoint list click ‘Settings’ –> ‘List Settings’

2) Scroll down to the bottom & click on the view you want to use as your datasource

3) Now your URL contains the {List GUID} as well as the {View GUID}

eg. /_vti_bin/owssvr.dll?Cmd=Display&List=%7BD66DCB51%2D80B0%2D43AB%2DB80B%2DCD7D23E63B09%7D&View=%7B6D0CEF69%2DF899%2D40D0%2D86B2%2D6E01CC7D9CA1%7D&XMLDATA=TRUE

4) The URL is encoded so you will need to replace “%7B” with “{” and “%7D” with “}” and “%2D” with “-” so now your url will look something like

/_vti_bin/owssvr.dll?Cmd=Display&List={D66DCB51-80B0-43AB-B80B-CD7D23E63B09}&View={6D0CEF69-F899-40D0-86B2-6E01CC7D9CA1}&XMLDATA=TRUE

5) Use this url as your XML data source in Infopath and your drop down data will be filtered as per your chosen view.

5 Responses to Populating an Infopath dropdown using a specific Sharepoint list view

  1. Thanks Peter. This article is very useful!

    For MOSS 2007, I had to build my own web service to return data table object to resolve the performance issue.

  2. All of the values returned in the dropdown have that weird ID and pound sign prefix in them. How do you strip that out before displaying in the dropdown?

  3. Hi Peter

    Thanks for this beautiful article. I have applied as intructed, but after delpoying the form facing following error.
    “XML data that is required for this form to function correctly cannot be found”.

    And this the link “https://servername/_vti_bin/owssvr.dll?Cmd=Display&List={2CFFA185-1B46-41A7-AECC-202B122B2911}&XMLDATA=TRUE&noredirect=true

    Your help will much appriciate

Leave a Reply