Populating an Infopath dropdown using a specific Sharepoint list view

By peter.stilgoe









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.

Share

, , ,

About... peter.stilgoe

peter.stilgoeThis author published 482 posts in this site.
Sharepoint, InfoPath, K2, Nintex, Business Process Mapping, Business Intelligence, Automation, ECM, Document Management, Document Imaging, Internet Marketing & Online Business Consultant Email / MSN: pstilgoe@hotmail.com LinkedIn: Pete Stilgoe - Sharepoint Consultant









Share

FacebookTwitterEmailWindows LiveTechnoratiDeliciousDiggStumbleponMyspaceLikedin

3 Comments

  • At 2011.03.03 21:23, ChrisMcCall said:

    OMG. You SAVED my life with this article. Thank You!!!!!

    [Reply]

    • At 2011.03.10 16:45, peter.stilgoe said:
      peter.stilgoe

      Just saw your thread on MSDN, glad it helped you out !

      [Reply]

      • At 2011.04.07 22:49, Eric Fang said:

        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.

        [Reply]

        (Required)
        (Required, will not be published)