Monday, March 7, 2011

Connecting Infopath form to Specific view in a List

Target User: Infopath Developer & Sharepoint Developer.

There are situation where we need to connect to specific view in a List. In my case, i had to populate my Infopath drop down with column values from a Sharepoint List.However, by default List can show only 100 records/items per page. So, my drop down will populate with only 100 items out of 600. So there are 2 ways to populate all 600 items in drop down:

  1. Either change your default view to show all 600 items per page.
  2. Create another view and make it to display 600 items per page.
Approach-1:
Displaying 100 items per page to 600 items per page by following below steps:
  • Click on your default view menu (top-right corner).
  • Modify View.
  • Move to 'Item Limit' section.
  • Change 100 to 600
  • Ok
Problem with Approach-1:
  1. Your requirement will not allow to display all 600 items per page.
  2. This will hit the performance, as for each page refresh; 600 items has to get loaded.
Approach-2:
With this approach, you can create another view which will display 600 items. This view you can use it for your internal stuffs only. While, user will see default view listing 100 items.

How to do this?
  1. Create New data connection which will retrieve data.
  2. Check option to receive data from XML document.
  3. (Important Step) Enter below URL to connect to specific view 
http://server-name/sites/site-collection/sitename/_vti_bin/owssvr.dll?Cmd=Display&List="list guid"&XMLDATA=TRUE&View="view guid"

  • URL in black should be your default site URL.
  • _vti_bin/owssvr.dll?Cmd= Display&: It should be constant as given. 
  • List="list guid": Indicate Sharepoint List to connect. e.g. List=%7B058B2418%2D6EAE%2D4870%2D919A%2D5FC55C05C49D%7D
  • &XMLDATA=TRUE: Indicate connecting and retrieving XML data.
  • View="view guid": Indicate connecting to specific view. User can get the GUID's for a List and View by following below steps:
    • Click on Settings menu.
    • Form Library Settings
    • Navigate to Views section.
    • Click on the view where you want to connect.
    • Check out URL bar where you will find View Guid.

Hope this article could save your precious time.

- Chintan, Bangalore,
- India