Skip to main content

Mike Geyer's Blog

A fun place to read and collaborate about SharePoint and related technologies.
Go Search
  

Keep in touch: RSS Feed  


I'm a


My company is a


And we deliver

  (we're certified)
Mike Geyer's Blog > Posts > Populating Form Data from SharePoint List Views
Populating Form Data from SharePoint List Views
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.aspx
2.  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
 
Now, open your favorite InfoPath book and look up how to create InfoPath Data Connections using this URL to an XML document.

Comments

receiving sharepoint list items in infopath forms through web service

I am trying to receive data from my sharepoint list into an infopath form. My problem is when I finally get the items in infopath, there are a lot of other fields which are not there. For eg I have a multiline data type field called Details, fields which are the based on the calculations, choice fields. Why does only few fields are retrieved and not all including the default list ID? If I use the tools>data Connection and select receive data from sharepoint list/library, then it will bring the list ID but it will still not bring the other fields. Is there a reason...am i missing anything?
at 8/9/2009 4:00 PM

 All Posts

Creating a SP List via Excel - Import from Spreadsheet
I've Moved to Hitachi Consulting
SharePoint 2010 Sneak Peak!
Business Intelligence During an Uncertain Time
Keeping In Touch with Family Around the US
Using Javascript to Manipulate a List Form Field
How to Use JavaScript to access SharePoint Query String
First Blog with Windows Live Writer
Microsoft to offer free classes and certification testing
Job Description - SharePoint Solution Architect
SharePoint Blogs as Status Reporting... and community building
Installing MOSS on WinServer 2008 with Hyper-V and SQL08
Keeping up with SP Blogs
Use Search as Content Roll-up
Web browser compatibility in InfoPath Forms Services
Picture Library: Getting to the Thumbnails
All about dates and SPD
Data View Web Part, learn it... love it!
MSFT's SharePoint 2007 Buzz Kit
Content Query Web Part (CQWP) for All List Types
Content Query Web Part (CQWP) with Anonymous Access
My Blog is Live
Examples of Common Formulas
Creating a Form to Add Items to a SharePoint List
Building a Blog Host
Scaling to Extremely Large Lists
Configuring Email Alert Templates
Populating Form Data from SharePoint List Views
SharePoint Designer Workflows and InfoPath Form Libraries
Restoring the Quick Launch Bar in Web Part Pages
Creating a Hyperlink to an InfoPath Form
Changes to SPD Created Workflows
How to find the CSS Class Applied to any SharePoint Element
Publishing an InfoPath 2007 Form Template to a Server Running InfoPath Forms Services
Why you Shouldn't Choose "Enable Rendering on a Mobile Device" when Publishing an InfoPath Form Template
Find Form Template for an Existing Library
Adding a Portal Breadcrumb to your My Site
Define Custom Permission Levels
Exchange 2003 Hotfix (Outlook 2007 and SP Alerts)
Copyright© 1997-2009 Mike Geyer
The posts on this weblog are provided “AS IS” with no warranties, and confer no rights. The opinions expressed herein are personal.