Saturday, January 26, 2013

Getting a specific list view as a data source in Infopath


1.       Create the view you intend to pull in SharePoint. Make sure to sort it and filter it the way you want it to appear in the drop down.
2.       Click on Settings->List Settings to get to the settings of the list you want to use.

3.       Scroll to the bottom where it shows views and click on the view that you want. This should be where you would edit the view.
4.       Go up to the URL and copy everything after List= (this is the GUID of the view).
5.       Place what you have in notepad.
6.        Replace %7B with { (this should be first part.
7.        Replace %7D with } (this should be the last part.
8.       Replace %2D with a –
9.       You should have something that looks like
{FCE658C5-54A5-4460-B9F4-6EE4CBF017D7}
Note:the numbers and letters are unique to your view but the formatting should be the same.
10.   Take the url of the site where the list resides and put it in front of the GUID
11.   Now you have the pieces to build your string. The format of the string is
<URL>/_vti_bin/owssvr.dll?Cmd=Display&List=<ListGUID>&View=<ViewGUID>&XMLDATA=TRUE
for example: 
http://site/_vti_bin/owssvr.dll?Cmd=Display&List={FCE658C5-54A5-4460-B9F4-6EE4CBF017D7}&View={B9BC3880-739B-4DA0-89A7-716775E755B7}&XMLDATA=TRUE
12.   You now have the string you need to create the data connection in Infopath.
13.   In Infopath you need to add a data connection.
14.   Create a new connection to receive data. Click OK.
15.   Choose XML document. Click OK.
16.   Paste the string you created in notepad into the Enter the location of the XML data file that you want to use as your data connection.
17.   Click next and okay until you are out of the wizard and you are ready to use your data source. If you are given a security prompt you can just click cancel.
18.   Note: everyone that uses the form must have read access (at least) to the list you are pulling from.

This article was taken from Michael Doyle from SharePoint Ninja

http://www.sharepointninja.com/Blog/Lists/Posts/Post.aspx?ID=13

No comments:

Post a Comment

About Me

My photo
Toronto, Ontario, Canada
MBA, M.Sc. & MCP