Udostępnij za pośrednictwem


Populating form data from SharePoint List Views

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.

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 “Modify settings and columns”
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&noredirect=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.

 

Some tricks:
1. When you’re in “Modify settings and columns,” if you click on one of the views in the list at the bottom, you should note that the URL is “enriched” with &View={ANOTHER_GUID}.  If you would prefer to use the columns from that view, you should similarly enhance the URL you use above.
2. You can also use the url to filter data rows based on column values. For example:

http://contoso/sites/sales/_vti_bin/owssvr.dll?Cmd=Display&List={115BC7B7-0A82-403E-9327-F3C73E6D37F3}&XMLDATA=TRUE&noredirect=true&FilterField1=xd__x007b_52AE1EF8_x002d_28E7_x002d_4CE4_x002d_AE23_x002d_54E23E80DDB5_x007d_&FilterValue1=Approved

Note: be sure to remove the “ows_” from the beginning of the FilterField ID.

 

With this filter, the XML file returned will be filtered to only display those projects that have been approved. Without the green portion, you would see all the projects.

 

In order to populate other fields with data from WSS, you create the secondary data source just like above, then in form code or script, you can use GetDOM(“dataSource”) and walk the DOM normally, updating the main DOM as appropriate.

 

Ed Essey
Program Manager

Comments

  • Anonymous
    January 22, 2007
    Hi, It may be just my browser, but it appears that the URL examples seem to be truncated.  Could you re-post the full URLs in the comments section? Thanks, William H

  • Anonymous
    January 22, 2007
    Sure:

  1. http://contoso/sites/sales/_vti_bin/owssvr.dll?Cmd=Display&List={GUID}&XMLDATA=TRUE
  2. http://contoso/sites/sales/vti_bin/owssvr.dll?Cmd=Display&List={115BC7B7-0A82-403E-9327-F3C73E6D37F3}&XMLDATA=TRUE&FilterField1=xd__x007b_52AE1EF8_x002d_28E7_x002d_4CE4_x002d_AE23_x002d_54E23E80DDB5_x007d&FilterValue1=Approved
  • Anonymous
    January 28, 2007
    Hi there. Thank you so much for the tips. It worked for me really well..until I convert the view page to XSLT Data View in FP. I had to convert it so I could use the grouping filter in FP. ie) a and (b or c). When I open the *.iqv file, it launched the excel but then give a alert saying "Unable to open" I thought it may caused by typo but when I tired again..before and after convert the webpart, it clearly does not like that. Could you please advise me on this matter?

  • Anonymous
    May 27, 2007
    Hi, Superb article,  it gave me answers for most of the doubts that i had in my mind :) I just want to know if we can dynamically alter URL for secondary data source. Say i want to create filter based on the values selected in another field of my infopath form... is it possible .... Regards, Sudhir Kesharwani

  • Anonymous
    September 06, 2007
    The comment has been removed

  • Anonymous
    October 03, 2007
    http://contoso/sites/sales/_vti_bin/owssvr.dll?Cmd=Display&List={115BC7B7-0A82-403E-9327-F3C73E6D37F3}&XMLDATA=TRUE&FilterField1=xd__x007b_52AE1EF8_x002d_28E7_x002d_4CE4_x002d How might I apply an XSL style transformation on the returned xml?

  • Anonymous
    December 16, 2007
    Sorry for asking such basic question but I need exactly what has been mentioned in this article. I have created the url and the data connection but I dont know how to show it on the form. Could anyone please ellaborate on this. thanks!!

  • Anonymous
    December 16, 2007
    the url I am using is http://mossvpc:1586/_vti_bin/owssvr.dll?Cmd=Display&List=%7BD66DCB51%2D80B0%2D43AB%2DB80B%2DCD7D23E63B09%7D&View=%7B6D0CEF69%2DF899%2D40D0%2D86B2%2D6E01CC7D9CA1%7D&XMLDATA=TRUE I hv extracted it the same way as given above

  • Anonymous
    May 16, 2008
    Is there a limit on the number of elements a share point list can have? I have a list with around 300 items (rows) and 4 columns but when i try to use this list to bind to drop down column i get only about 100 returned. Is there a way to oversome this?

  • Anonymous
    May 16, 2008
    Hi c10, Is there a limit on the number of elements in a SharePoint list? There may be - but you may want to post that question to a SharePoint blog. However, the behavior you are seeing in InfoPath is expected. The items that are returned in a data connection are based on the default View in SharePoint. Each view in SharePoint, by defauly, limits the number of items to display to 100 - hence you only get 100 items returned. To workaround this:

  • Navigate to your SharePoint list
  • From the View dropdown choose Modify this view
  • Scroll to the bottom and expand the "Item Limit" section
  • Change 100 to something larger than what you would expect this list to store (i.e. 500, 1000, etc.) I hope this helps! Scott
  • Anonymous
    June 12, 2008
    Hi, I am very new with Infopath, so I apologize for the simplicity of the question.  I am using this code to essentially create a sharepoint/infopath based mail merge.  It is working GREAT, except I can't move to the next record.  Any suggestions? Thanks in advance! Wendy

  • Anonymous
    July 31, 2008
    The comment has been removed

  • Anonymous
    August 28, 2008
    Hello,     I'm experiencing a weird behavior with the way the data connection is reading the XML file in my drop down controls. When I attempt to set the "Entries" field to "z:row", I am prompted with the error "You must select a repeating group or field."     I have another form where I followed the same directions you outlined above, but I generated a resource file, and the "z:row" field is indeed a repeating field and works just fine.     Is there a reason why this data connection is pulling the "z:row" field as a non-repeating? Am I missing a step? Thanks in advance - K

  • Anonymous
    February 09, 2009
    The comment has been removed

  • Anonymous
    February 09, 2009
    The comment has been removed

  • Anonymous
    February 11, 2009
    Hi, Scott - thanks for the reply.  I will try Fiddl'ing. Jan

  • Anonymous
    February 12, 2009
    The comment has been removed

  • Anonymous
    February 12, 2009
    The comment has been removed

  • Anonymous
    February 13, 2009
    The comment has been removed

  • Anonymous
    March 18, 2009
    Good article... I've created my data connection into a list, but the field that I want to display in my InfoPath dropdown is a calculated field in the list.  It won't give me the option to show that field.  

  • Anonymous
    April 14, 2009
    Hi, good article. I've created my data connection, and works fine, but, in a calculated field display "string;# " in the begging of the field. How i can remove this? thanks

  • Anonymous
    April 15, 2009
    The comment has been removed

  • Anonymous
    April 15, 2009
    Hi Scott, thank's for your quick responde. I'll try. João

  • Anonymous
    April 15, 2009
    Hi Scott, many thanks. it's works very well. regards, João

  • Anonymous
    April 20, 2009
    Hi. I'm relatively new to Infopath and Sharepoint and the example described above is exactly what I am trying to achieve. I can filter the fields and return the xml to a drop down list ok. From the filtered fields I am populating a repeating table. My problem is the text being returned contains html tags, <div> text </div> or 1,#Name. I also don't really understand your statement in the example: "Note: be sure to remove the “ows_” from the beginning of the FilterField ID." or how to achieve this. Any help would be welcome. Thankyou GrahamP

  • Anonymous
    April 21, 2009
    This is a great post! I can't find the "Modify settings and columns" area. Does this apply to WSS?

  • Anonymous
    April 21, 2009
    Grahamp - what are the data types of those columns in SharePoint? doubleH - "Modify Settings and Columns" was the terminolgy used with SharePoint 2003. In 2007, simply navigate to your list and from the "Settings" menu choose "List Settings." Scott

  • Anonymous
    April 22, 2009
    Thanks Scott. Here is the URL I am trying to use... http://lynx/_vit_bin/owssvr.dll?/?Cmd=Display&List={%7B609688A9%2D3FBA%2D4FA6%2DAF27%2D695DF7422F40%7D}&XMLDATA=TRUE I am getting an error... The following file(s) have been blocked by the administrator: /_vit_bin/owssvr.dll Any ideas on how to correct ?

  • Anonymous
    April 22, 2009
    Hi doubleH, Hmmm...I have never seen this error before when using this sample. You may want to post this to a SharePoint blog to see if they can offer any suggestions as to where to look to identify the cause of the error. Scott

  • Anonymous
    April 25, 2009
    Hi Scott I'm using rich text and lookup data types. I've changed the rich text to plain text and that seems to work fine, however I need to use the lookup value in sharepoint and can't change this. Is there a way around using the lookup and returning the value which is a name in this case without the 1,# prefixing the name. Thanks Grahamp

  • Anonymous
    April 27, 2009
    Hi Grahamp, Yes - you will need to hand-modify the View (the XSL file) that contains the control (i.e. the dropdown) that is showing the values. Take a look at the steps I provided to jccarvalho on Wednesday, April 15, 2009 11:27 - these are the same steps you will need to complete. Scott

  • Anonymous
    June 10, 2009
    How to connect to a XML file or SharePoint list sized at around 5500 records in browser-enabled Infopath form 2007 Dear All, I have a data file which contains around 5500 records of user data. I created two data connections -one to very huge XML file and another to very huge SharePoint list. However both can't work in Browser form due to server timeout or what ever make the server can't response. Once I cut it 1/4 in size of records then it wokrs hence I guess this is due to too many records. I am wondering if there is anyway to connect to a single database file size @5500 records in browser-enabled InfoPath form? I don't have the SQL server. Please help! Regards, Ada

  • Anonymous
    June 24, 2009
    The comment has been removed

  • Anonymous
    June 25, 2009
    The comment has been removed

  • Anonymous
    June 25, 2009
    The comment has been removed

  • Anonymous
    June 25, 2009
    Scott Update to my last post All works fine if I simply insert a hyperlink control using text. The problem occurs if I insert a graphic and then apply the hyperlink to read the field1 data source. The link simply reverts back to read the address field which is not populated. Thanks Grahamp

  • Anonymous
    June 25, 2009
    Hi Grahamp, What do you mean by "insert a graphic?" Can you provide me the steps you are following? Thanks, Scott

  • Anonymous
    June 26, 2009
    Hi Scott Sorry, I wasn't very clear. I'm using an image of a "GO" button in a cell next to the drop down list. The image is simply pasted into the cell and then I apply a hyperlink to the image that reads the value in the drop down list. Users select from the list and then the GO image to get the document. Hope this explains it better. Thanks Grahamp

  • Anonymous
    June 26, 2009
    The comment has been removed

  • Anonymous
    June 26, 2009
    Scott I checked the links and all are being returned correctly. Exactly as you described above I pasted an image and set the hyperlink to the Datasource. However before previewing I rechecked the hyperlink and find the "Link to: value has changed and the Adress is now selected displaying "http://address" with the Datasource greyed out. Totally confused? Grahamp

  • Anonymous
    June 26, 2009
    Hi Grahamp, Well on the positive side...at least we know why the link does not work! :) Let's look at something else: are you using the method described in this post to retrieve the fields from your list? If so, I was not - I was just using a standard SharePoint list data connection so I may need to try this method to see if there is any difference in the result. Also - how did you create the hyperlink column in SharePoint? Was it just adding a hyperlink column to your library or was it a site column? Can you provide me with a sample URL that you have in one of those fields? Scott

  • Anonymous
    June 26, 2009
    The comment has been removed

  • Anonymous
    June 26, 2009
    Scott FYI I managed to find this link describing the same problem http://www.microsoft.com/communities/newsgroups/list/en-us/default.aspx?dg=microsoft.public.infopath&tid=bb848d55-6ce1-4605-99bf-6a3ced937e31&cat=&lang=&cr=&sloc=&p=1 Grahamp

  • Anonymous
    June 29, 2009
    The comment has been removed

  • Anonymous
    June 29, 2009
    Hi Scott Aaaha it works but don't ask me why! The only thing that we are doing differently is that I am selecting Insert > Picture> From File and you are copying and pasting. Infopath will not let me paste a copied image from the clipboard onto the view, all options to cut, copy and paste are greyed out. When I copy an image already in my view and paste it into the required cell it works fine. So the operative word here is "paste" Any ideas why? Grahamp

  • Anonymous
    June 29, 2009
    Hi Grahamp, Very odd - I just tried the same method: Insert | Picture | From File and it still works fine. I have not seen an issue before where you could not paste an image into an InfoPath View while in Design View. I hate to ask this question (especially on a public forum <g>) but does the same behavior occur if you reboot, which will clear your clipboard? At any rate, there is something to be said for "if it's not broken, don't fix it" <g> now that it is working! :) Scott

  • Anonymous
    June 29, 2009
    Hi Scott I was wondering if I should feel embarrased, but no the problem remains. I think enough said and I'll just work around it. Many thanks for your help. Now back to reality! I have a sharepoint list with 7 columns plus an ID col. I am using the method described in this post to populate a repeating table with information contained in 3 of the columns. 2 other columns plus the ID are used to filter the list information into the appropriate form. All works well. Information for the remaining 2 list columns is to be entered by the user in the form and submitted back to the sharepoint list to close the loop and allow reporting of the action taken. I have read your article on submitting to a sharepoint list but am having problems modifying the process to suit my application. Any help would be appreciated. Grahamp  

  • Anonymous
    June 30, 2009
    Hi Grahamp, Sorry I was not able to fully help on the hyperlink...obviously something is still different in our scenarios but not sure what. In regard to submitting to a SharePoint list, you will need to review all the comments as well in that post. Typically custom code is used to do anything other than an "add" and in my post there is sample code to perform an update and delete. (In fact, I think the sample code handles all options: add, update and delete.) The reason code is used is you need to know which list item you want to update or delete and this is done by the SharePoint ID for the specific list item. Granted you may be able to get what you need without code but this is one of those scenarios where, personally, I feel it is easier to use code to do what you need. If you have any additional questions on updating a SharePoint list, please be sure to post them on that blog. Scott

  • Anonymous
    July 18, 2009
    The comment has been removed

  • Anonymous
    August 13, 2009
    The comment has been removed

  • Anonymous
    November 16, 2009
    Thank you for all of the great information so far.  I have been able to set up that connection and retrieve data that I have populated into a drop down list.  At this point, I am trying to create a rule to auto-populate other fields in my form based off of the selected value in the drop down list.  I past instances where I create a normal connection to Sharepoint, I would use a rule similar to... Field:  hoursCharged Value:  @hoursCharged[@projectID=projectID] This worked fine but when I try the same type of formula in the value field using an XML connector ti will not work.  Any suggestions?

  • Anonymous
    December 27, 2009
    Do you know of a way? user opens form, populates fields, infopath dropdowns are selected,form submitted. How do you take the information from this form and subtract it from the list used in the dropdown. So the next user will not have access to the items the previous user selected? Or for a lack of a better term checked out but not to be confused with checking forms in or out from sharepoint.  I find nothing but limitations with these collaborating tools? Infopath and sharepoint? please advise?

  • Anonymous
    January 10, 2010
    I am also having trouble removing the # from the account id name list.  My view1.xsl for my dropdown looks very different that what you have posted. Can you help me with the syntax to code my substring parameters.I only see two place to insert the substring. Here is my code. xd:xctname="dropdown" xd:CtrlId="CTRL665" xd:binding="my:Sys1BusOwner" xd:boundProp="value" value="Select..." xd:postbackModel="auto" tabIndex="0"> <xsl:attribute name="style">WIDTH: 100%; FONT-SIZE: x-small;<xsl:choose> <xsl:when test="my:Sys1BusStatus = &quot;Denied&quot; or my:Sys1BusStatus = &quot;Approved&quot; or my:Sys1BusStatus = &quot;N/A&quot;">DISPLAY: none</xsl:when> <xsl:when test="../../my:Hidden_Section/my:CurrentUserPermissions != &quot;Admin&quot;"/> <xsl:when test="my:Sys1BusOwner = ../../my:Hidden_Section/my:Current_User">BACKGROUND-COLOR: #ffff00; COLOR: #ff0000; FONT-WEIGHT: bold</xsl:when> </xsl:choose> </xsl:attribute> <xsl:choose> <xsl:when test="my:Sys1BusStatus = &quot;Denied&quot; or my:Sys1BusStatus = &quot;Approved&quot; or my:Sys1BusStatus = &quot;N/A&quot;"/> <xsl:when test="../../my:Hidden_Section/my:CurrentUserPermissions != &quot;Admin&quot;"> <xsl:attribute name="disabled">true</xsl:attribute> </xsl:when> <xsl:when test="my:Sys1BusOwner = ../../my:Hidden_Section/my:Current_User"/> </xsl:choose> <xsl:attribute name="value"> <xsl:value-of select="my:Sys1BusOwner"/> </xsl:attribute> <xsl:choose> <xsl:when test="function-available('xdXDocument:GetDOM')"> <option/> <xsl:variable name="val" select="my:Sys1BusOwner"/> <xsl:if test="not(xdXDocument:GetDOM(&quot;Business Owner Sorted&quot;)/xml/rs:data/z:row/@ows_Business_x0020_Owner2[.=$val] or $val='')"> <option selected="selected"> <xsl:attribute name="value"> <xsl:value-of select="$val"/> </xsl:attribute> <xsl:value-of select="$val"/> </option> </xsl:if> <xsl:variable name="items"> <xsl:for-each select="xdXDocument:GetDOM(&quot;Business Owner Sorted&quot;)/xml/rs:data/z:row/@ows_Business_x0020_Owner2"> <attributeElement> <xsl:value-of select="."/> </attributeElement> </xsl:for-each> </xsl:variable> <xsl:variable name="uniqueItems" select="msxsl:node-set($items)/*[not(. = preceding::attributeElement)]"/> <xsl:for-each select="$uniqueItems"> <option> <xsl:attribute name="value"> <xsl:value-of select="."/> </xsl:attribute> <xsl:if test="$val=."> <xsl:attribute name="selected">selected</xsl:attribute> </xsl:if> <xsl:value-of select="."/> </option> </xsl:for-each> </xsl:when> <xsl:otherwise> <option> <xsl:value-of select="my:Sys1BusOwner"/> </option> </xsl:otherwise> </xsl:choose> </select>

  • Anonymous
    January 11, 2010
    The comment has been removed

  • Anonymous
    January 11, 2010
    Scott, You were right.  When setting up my dropdown control I was drilling too far down for my Entries selection.  Good catch.  It is working like a charm now! lluke

  • Anonymous
    January 11, 2010
    That is great to hear! Scott

  • Anonymous
    January 12, 2010
    Scott, I have one more issue.  My changes work fine in preview, but when I attempt to open the form in the browser I get the message 'The form has been closed'. Any ideas.   lluke

  • Anonymous
    January 12, 2010
    Scott, I am having an issue w/the solution.  It works great however if one of the columns in the Sharepoint list has all NULL values, that column is not returning in my XML.  I have tried querying the default list and a view I created, neither one seems to work on NULL columns, is there any workaround for this?

  • Anonymous
    January 12, 2010
    Scot, And yet one more issue. I have removed the data connection for the substrings until I can figure out why the form won't open.  I still have one xml file data connection which works just fine, but only for me.  When other users open the form from the url, they get this error. "The form cannot be opened because it requires the domain permission level. Log ID 5566 Error." Permissions are set correctly for the list and library. I am not sure what other permissions need to be changed.   lluke

  • Anonymous
    January 13, 2010
    lluke: for both of your new issues, I would enable "Verbose" logging for all of the Forms Services categories, reproduce the issue and then check the SharePoint ULS logs - hopefully there will be more detailed information there about what is causing the errors. If not, you may want to open a support case as we want to keep the questions/comments on our various blog posts specific to their respective topics. Stone 13: This is expected - if there is nothing in that column in SharePoint, the corresponding XML node does not exist - hence, you get this behavior. The easiest way around this is to simply set a default value for that field. Scott

  • Anonymous
    January 19, 2010
    Thanks! Using the url trick i was able to solve a sorting problem with my drop down content bound to an SP List. Drop downs in Info Path web forms were sorted in creation date order, instead of alphabetical order. Binding to the returned xml file instead of directly to a list solved my problem :)

  • Anonymous
    February 25, 2010
    Hello to all... this is a great articvle and i can almost use it. I have a sharepoint list and a form that queries that list using a data connection. The list is already sorted but when the drop menues get populated in the web-form they are not sorted. When you say "Go to modify settings and coloumns", where do you mean? My list URL shows this: http://collab.safeway.com/it/Contentmgmt/Lists/Consumer%20Protection%20Multi/Allitemsg.aspx I dont see anything containing a GUID or "_vti_bin...". Where do i get the GUID? Thanks a bunch and any help is appreciated.

  • Anonymous
    April 27, 2010
    This probably isn't the right post for this but maybe somebody can point me in the right direction. I'm using infopath 2003 with sharepoint 2007.   I have a form with a drop down list that uses a column from a sharepoint list as a data source.   The column has numerous duplicates but I'm trying to retrive a unique list.   I've been trying trying to stumble my way through trying to create a filter but haven't had much luck. Any help or suggestions would be great I haven't had much with the posts I've found so far. Thanks

  • Anonymous
    April 29, 2010
    Is there a way to specify the row from a list that data in the columns are used to populate the infopath form.  In other words, I have 8000 employees and want to populate a portion of a form with info from a SP list for a specified employee.  How can I tell the infopath form what employee I want to pull from?

  • Anonymous
    May 07, 2010
    Hi - We have used your "View" method to bind only a view of a list to a control many times and it works beautifully.  However, I recently did the same thing on a list that is a content type, and the results were not as expected.  I created a view of the list, selecting only the columns I wanted to choose from on my InfoPath form, but when I brought up the form in Infopath and tried to bind to a control, other columns were there (from other views) and some of the columns I wanted were not.  Does this method not work with a list that is created using a content type? Thanks, Shelly

  • Anonymous
    May 07, 2010
    Hey Scott, How to use ur technique for Accessing Subfolders via secondary data connection ...i have folders in my Form Library and when i make a data connection from infopath to the library it works only at the root level and does not work inside the folder ie it does not get value when the form is inside a folder..any idea how can i solve this issue

  • Anonymous
    May 10, 2010
    Hi sharepoint99, I don't know of any way to get this process to work with subfolders in a library. Scott

  • Anonymous
    June 24, 2010
    The list I am accessing has a lookup column in it. It is this column I am interested in.  When the data is displayed in my browser infopath form, the lookup ID and Value are displayed.  I.E. 23;#BOM.  How do I just retrieve the Value? (BOM)

  • Anonymous
    July 14, 2010
    This is great and it works, but when I update data in the list, the data that is in the form is not updated, is still contains the old data, even data that has been deleted from the list.  I was hoping it would be dynamic but it seems to be static.

  • Anonymous
    July 15, 2010
    Hi MarsdeNation, When you setup the data connection you want to make sure you choose the option "Access the data from the specified location" - this is not the default option. As such, if you left the default option (Incluse the data as a resource file...) then the data will not automatically refresh. Scott

  • Anonymous
    July 21, 2010
    hi there, thanks for this useful post, i'm able to see the data when previewing in infopath as well as when pasting the URL to the browser's address bar but once i'm loading it inside an infopath web part, i'm getting this error.... An error occurred querying a data source. Click OK to resume filling out the form. You may want to check your form data for errors. Hide error details XML data that is required for this form to function correctly cannot be found. An entry has been added to the Windows event log of the server. Log ID:5566 Correlation ID:6558c56a-e6e5-4c6d-80fc-95af77785a5f

  • Anonymous
    August 11, 2010
    Joel, do you still have this XML Data problem? I too have this problem. The form and code work fine when opened in infopath (on the sharepoint server) and displays/filters the correct values, but when published to my sharepoint site, it opens and shows all values, except when I select one from the first column, it gives me that error. Cannot find anything in the event logs on the server.

  • Anonymous
    August 11, 2010
    The comment has been removed

  • Anonymous
    September 30, 2010
    The comment has been removed

  • Anonymous
    October 01, 2010
    Hi Durbs-99, I don't believe I am able to reproduce what you are seeing - here is what I did for a test:

  • Have a custom SharePoint 2007 list with 20 items
  • My default view for the list shows the items in groups of 5
  • I created a new SharePoint view that shows all items
  • In my XSN, I added two data connections: LimitedItems: http://servername/_vti_bin/owssvr.dll?Cmd=Display&List={4A837605-81CD-4F27-9C3B-4A6EEF62B379}&XMLDATA=TRUE&noredirect=true AllItems: http://servername/_vti_bin/owssvr.dll?Cmd=Display&List={4A837605-81CD-4F27-9C3B-4A6EEF62B379}&View={D826BE04-4346-44DB-9277-018B59FDAFB0}&XMLDATA=TRUE&noredirect=true
  • Added 2 dropdown list boxes to my InfoPath Form Template
  • Bound the above data connections to the dropdown list boxes
  • Published the XSN to my server
  • Opened it in the browser - result: one showed 5 and the other showed all 20. Out of curiosity what happens if you just drag the data connection to your view as a "Repeating Table" - this makes it easier to see how many items are truly being returned. Scott
  • Anonymous
    October 06, 2010
    Hi i am working with this SharePoint URL protocol, its quite good. But my question is can i get list item versions using this URL protocol concept and also can i apply filter operator, for example Example: http://contoso/sites/_vti_bin/owssvr.dll?Cmd=Display&List={115BC7B7-0A82-403E-9327-F3C73E6D37F3}&XMLDATA=TRUE&FilterField1=ID&FilterValue1=2&FilterOp1=Geq Is there a way to use filter operator in URL protocol. thnxs

  • Anonymous
    October 31, 2010
    I got a question I'm hoping someone can answer.  I've used this URL protocol successfully many time in my SharePoint 2007 environment, however, when I try to replicate in my SharePoint 2010 Dev Environment I get a file not found error when I run my form with the code.  I believe the issue could be tied to the fact that when I type the url and put in the browser, it prompts me to save rather than just displaying in the browser.  Does anyone have a solution for this?

  • Anonymous
    November 01, 2010
    Update: I figured out what the issue was with my SP 2010 error.  For My Filter Field Value, I was using a field name with a space in it.  To get it to work, I had to click on the field and get the actual field name and place it in my string and it worked.

  • Anonymous
    January 05, 2011
    Hi, I tried modifying the XSL for string;# issue in the dropdownlist items, but if i add substring-after() and Preview the form, dropdown look ok, but when i try to publish and upload the .xsn on my sharepoint server it gives me - 'Unknown errror' while trying to upload the form. Any idea what's causing that?

  • PB
  • Anonymous
    January 21, 2011
    I need to have cascading dropdowns in my infopath form.   My question is how to I select from a dropdown and filter the data in the second list using c# code? I would like to use the changed event to drive the retrieval of the second list and then bind back to the dropdown. This is a very customized form. I have attempted this using the filters on the dropdowns but it does not work in the basic template for an unknown reason.

  • Anonymous
    March 03, 2011
    Hi,   Good article. Now i am working on infopath forms in sharepoint. I want to print the infopath forms stored in the sharepoint as .xml files using C# and aspx pages of wsp project programatically. Can you have any idea about it? Waiting for the reply .......  Thank you....

  • Anonymous
    March 08, 2011
    The comment has been removed

  • Anonymous
    April 15, 2011
    Does this work in Infopath 2007.  I thought I could set up a secondary data connection.  It allows me to set it up initialy but when I try to modify it or use in the form. It tells me that I can't connect. But I have the SharePoint list open in my browser so I'm obviously able to connect.

  • Anonymous
    October 12, 2011
    I have a travel request form, and I created a list in sharepoint with profiles containing preferences of the member who will fill the form. I want to retrieve these preferences and fill them in the correct fields depending on the user. How can I do that? Please help

  • Anonymous
    October 12, 2011
    The comment has been removed

  • Anonymous
    November 11, 2011
    I am having an interesting issue with this.  I am setting up this connection for an Infopath 2010 form.   As long as I put the guid in without the {}'s it allows me to set it up.   As soon as I put the guid between the {} it tells me the internet address is not valid. Any suggestions?   I suspect that not having it in the {} is causing another issue. Thanks

  • Anonymous
    November 17, 2011
    Dropdown changed event woking fine in Infopath preview, when I published in Sharepoint server 2010 the event is not firing

  • Anonymous
    November 17, 2011
    The comment has been removed

  • Anonymous
    February 16, 2012
    The comment has been removed

  • Anonymous
    February 22, 2012
    The comment has been removed

  • Anonymous
    May 15, 2012
    Hi! I am having similar issues to Vinod and Amanda. I tried the suggestion that Scott suggested to Vinod, there was no change in the browser behavior. Amanda's suggestion might works, but I do not have access to publish administrator-approved templates - as I will never get server administration access. Is there a solution to have results sorted alphabetically in a browser on SP2007 with InfoPath 2007 that I can implement??

  • Anonymous
    May 16, 2012
    The comment has been removed

  • Anonymous
    July 03, 2012
    Hi,   Really this thread help me alot. Thank you.

  • Anonymous
    July 08, 2012
    This article helps me a lot. Extra I want to set a filter in the url on the current user "to filter 'My projects'". Is this also possible? Did someone find a solution for this?

  • Anonymous
    September 26, 2012
    Hi Guys, Is there a way to count the number of items returned using this method?  count() seems to be counting the number of columns in the view and not the list items itself? Thanks JP

  • Anonymous
    October 04, 2012
    Hi CubixVision, Sure - you want to use the "count" function on the repeating node that is returned. So your data connection should look like this: xml  s:Schema  rs:data    z:row "z:row" should be a repeating node with your list columns under it. As such, your expression to count those rows would look like this: count(row) If you were to click the "Edit XPath" option in the Formula screen, it would look like this: count(xdXDocument:GetDOM("owssvr")/xml/rs:data/z:row) Scott

  • Anonymous
    January 23, 2013
    Hi. Can't get it to work. Here is my URL http://ServerName/SubSite/_vti_bin/owssvr.dll?Cmd=Display&List={3EF4226D-0470-4237-ACE9-179F3D82D08B}&XMLDATA=TRUE&noredirect=true A couple of things:

  1. How do I add it to InfoPath? What type of connection type is best?
  2. I have created the URL and tried it in several of the data connection types (XMl..) and I get the following error "Internet Address "my url above" is not valid". What am I missing? Do I need to register the owssvr.dll file? Any help would be appreciated. Thanks.
  • Anonymous
    January 23, 2013
    ----Edit to above.---- I think the error that I was receiving was due to the fact that I am try to connect to a list that is an external content type. It works with a regular list. Any idea how to dynamically filter an external list?

  • Anonymous
    January 24, 2013
    I am new to this blog, my apologies if the answer is here and I missed it. I'm working with InfoPath Desiger 2010 and SP Server 2010. I was able to add an XML data connection to my form to sort the SP list, but when I change or update the list, the changes do not appeaer to carry over to the InfoPath form. The data connections via a SP list update accordingly, but not via XML connection. Any help would be greatly appreciated! Joni

  • Anonymous
    February 26, 2013
    Hi- I successfully connected the XML file to my dropdown list, modified the view1.xsl file as directed in an earlier post and successfully previewed the clean- non 'string#;' prefix for my information.  However, when I publish the form back to my SharePoint list and attempt to add a new item, I get an error that says: ERROR: The "BrowserFormWebPart" Web Part appears to be causing a problem. Expression must evaluate to a node-set. Web Parts Maintenance Page: If you have permission, you can use this page to temporarily close Web Parts or remove personal settings. For more information, contact your site administrator. Anyone else see this or have any idea why it would happen????

  • Anonymous
    May 24, 2013
    Hi, I have tried to use the view as a data connection: http://servername/_vti_bin/owssvr.dll?Cmd=Display&List={4A837605-81CD-4F27-9C3B-4A6EEF62B379}&View={D826BE04-4346-44DB-9277-018B59FDAFB0}&XMLDATA=TRUE&noredirect=true (formed the url corresponding to my list and view guids) The data connection works but it loads only the First 30 Items of the view and my view has got more than 30 items. The rest of the items are truncated. Same is the case when I paste the above url in browser, it doesnt show all items of the view. Please help. THanks Anil Bingu

  • Anonymous
    June 05, 2013
    Hi I'm using the following URL to return data to Excel: http://<myserver>/.../_vti_bin/owssvr.dll?Cmd=Display&List=%7B22332672%2D8AD2%2D4A9D%2DB2B7%2D28D7416D5A8D%7D&View=%7BA454B55A%2DBC9E%2D4F77%2D8C0C%2DA74ED95F906E%7D&Query=*&XMLDATA=TRUE&FilterField1=MyNumber&FilterValue1=1 This works fine, but does not return columns from my list which are null.  Is there a way of returning all columns regardless of their data content? I've tried specifying the column in the &Query parameter but that didn't work.  Any ideas? Thanks Charles

  • Anonymous
    December 30, 2013
    Hi Scott, I tried below changes in my code, however I am getting the error "Infopath cannot open the form".


<xsl:if test="not(xdXDocument:GetDOM("test")/xml/rs:data/z:row/[substring-after(@ows_Authorised_x0020_User_x0020_Name,"#")[.=$val]] or $val='')"> <option selected="selected"> <xsl:attribute name="value"> <xsl:value-of select="$val"/> </xsl:attribute> <xsl:value-of select="$val"/> </option> </xsl:if> <xsl:for-each select="xdXDocument:GetDOM("test")/xml/rs:data/z:row/[substring-after(@ows_Authorised_x0020_User_x0020_Name,"#")]"> <option>


Please guide me through. Also these are browser enabled forms.

  • Anonymous
    June 16, 2014
    This is a great post. Thank you! Unfortunately, the XML Secondary DataSource only refreshes when all instances of Infopath are closed. I have a submit-rule to open up another instance of the same form. However, the XML datasource does not update even if i add a rule to the form_load event to re-query the secondary XML File datasource. If i look at the XML file in the browser windows, the data is there and correct, however infopath's version of this xml data was from when the first form opened and not when the second form opened and i requeried using the rule "Query using a data connection" to the XML data source. I know that the xml file should be changing, but it is not. However, if i open the form from sharepoint's list's "New" button, the xml file is queried correctly. Since i am using the XML file as a means to get the MAX(ID) of the main sharepoint list (This would essentially filter/limit the list to just the latest ID), this solution does not work. Without a solution using an XML File, i have to query the document library. My document library is very large and without an XML File solution, the infopath form loads very slow. However, with the XML file solution, i don't get a unique ID from the MAX(ID) function. So essentially, i am stuck between a rock and a hard place and it is infopath is proving to be a bad solution for large document library lists without it.

  • Anonymous
    August 21, 2014
    i checked.. filtering works like this: &FilterField1=Project_x0020_ID&FilterValue1=2007650B75

  • Anonymous
    November 16, 2014
    the problem is that the database does not refresh...an idea

  • Anonymous
    December 23, 2014
    Hello, hope anyone will see that comment. I am using InfoPath 2013 and try to add Data Connection to: collaboration.kraft.com/.../owssvr.dll{4E06076A-FABD-4677-B840-AE3A63A13DEE}&XMLDATA=TRUE But the only thing I get is : InfoPath can't open XML document. The file is not a valid XML It seems to blank What am I doing wrong?

  • Anonymous
    December 23, 2014
    Something wrong with the link view: "https:// collaboration.kraft.com/sites/ <site name> /_vti_bin/owssvr.dll? Cmd=Display& List={4E06076A-FABD-4677-B840-AE3A63A13DEE}&XMLDATA=TRUE

  • Anonymous
    January 06, 2015
    Hi Gregory, The first thing you will want to do is make sure the URL you are creating is valid and that it works in Internet Explorer. If you don't get data back in IE, then it will not work in InfoPath.

  • Launch IE
  • Copy/paste this URL (after fixing the site placeholder) and see if you get data in IE: https:// collaboration.kraft.com/sites/ <site name> /_vti_bin/owssvr.dll? Cmd=Display& List={4E06076A-FABD-4677-B840-AE3A63A13DEE}&XMLDATA=TRUE&noredirect=true You should see the list data being returned in the browser. If not, then make sure the list exists at the level of your URL. As an example, if the list is actually at the root site but you are specifying a subsite, then it will fail. Scott
  • Anonymous
    February 03, 2015
    Hi, I have the connection string working, I want to filter it to data that is contained within a field on the inforpath form I am using to connect to the list. Is there anyway to enter the field into the filter part of the connection string? I have tried using the field xpath data and field name after FilterValue1 without any luck. To test I have manually provided some demo data of this field in the value and viewed the filtered xml within the browser and it worked, but I need that dynamic data from the field in the actual form.

  • Anonymous
    March 11, 2015
    Hello. Thanks for the post. I have a question about filtering the secondary data connection. I was following the steps outlined on the post dated Oct 12, 2011: I added a button with the following actions: Set a field's value:@ows_ID=field6 Query using data connection:owssvr Set a field's value:field1=@ows_field1 But I am getting an error message "some rules were not applied, the paramter is incorrect." Any help is appreciated. My secondary data source contains over 5000 items so I'm hoping to be able to only connect to the one record I need on my form.  Thanks so much.

  • Anonymous
    May 01, 2015
    The comment has been removed