John wrote:
You have a great article on submitting InfoPath 2007 form data to a sharpoint list. However, how can you submit a repeating table of data to a Sharepoint list? Help, I have a timesheet that I would like our nation managers to submit and have those rows on the repeating table populate the sharepoint list for our payroll dept. We need this because we want the ability to query the data when we have audits.
Hi John,
There are basically two ways to do this:
- Loop through all the rows of the repeating table (see How to loop through items in a repeating table in InfoPath 2007). For each row you can construct a CAML batch as the article describes and then submit the data to the web service. The disadvantage of using this method is that you will have to call the web service each time you submit a row.
- Create a CAML batch that accepts multiple items that can be submitted to a SharePoint list in one action. You can then loop through all the rows of the repeating table. You must extract the data from each row and with that data construct a Method element that you can add to the Batch element that will be submitted to the SharePoint list. Once each row of the repeating table has a corresponding Method element in the Batch, you can call the Execute method on the data connection for the web service. The advantage of using this method is that you will only have to call the web service once to submit all of the data.
A simplified CAML batch for the second method could look something like the following:
<?xml version="1.0" encoding="UTF-8" ?>
<Batch>
<Method ID="1" Cmd="New">
<Field Name="Title" />
</Method>
<Method ID="2" Cmd="New">
<Field Name="Title" />
</Method>
</Batch>
You can add a secondary data source for the CAML batch shown above (with a minimum of 2 Method elements) to your InfoPath form template. This will allow you to programmatically add multiple Method elements to the Batch. Reason: If your initial CAML batch XML file only has one Method element and you try to add another one programmatically, InfoPath might complain about schema violations. By adding 2 Method elements in your initial CAML batch XML file, you are telling InfoPath that your batch accepts multiple Method elements instead of only one.
I hope this answers your question, John. And good luck with your timesheet project!
Update: A complete solution to this question can be found here: How to submit the rows of a repeating table in InfoPath to a SharePoint list.

Comments to this post were closed 30 days after it was published.