I have no idea how to submit repeating table data to SharePoint list using WCF service but you can submit the data contained in repeatable table of InfoPath using SharePoint Object Model. I have done this using SharePoint Object Model and it is working absolutely fine.
The below code was written to submit details of Victim's Basic Information like Name, DOB, CaseNumber, Nationality, etc.. to a SharePoint Custom List.
This is the actual code I have used in my project but you can edit in the way you want.. :)
Pls let me know if you have any queries.
using Microsoft.Office.InfoPath;
using System;
using System.IO;
using System.Xml;
using System.Xml.XPath;
using System.Collections.Generic;
using System.Collections;
using System.Data;
using System.Text;
using Microsoft.SharePoint;
using System.Security.Principal;
using Microsoft.SharePoint.Utilities;
namespace CMSForm
{
public partial class FormCode
{
private const string REQUEST_MODE_CONTROL = "/my:myFields/my:DeveloperSection/my:RequestMode";
private const string CASENUMBER = "/my:myFields/my:CaseNumber";
public void InternalStartup()
{
((ButtonEvent)EventManager.ControlEvents["btnSubmit"]).Clicked += new ClickedEventHandler(btnSubmit_Clicked);
}
public void btnSubmit_Clicked(object sender, ClickedEventArgs e)
{
try
{
SPSecurity.RunWithElevatedPrivileges(delegate()
{
_RequestMode = _root.SelectSingleNode(REQUEST_MODE_CONTROL, this.NamespaceManager).Value.Trim();
WriteLog("_RequestMode :" + _RequestMode);
if (!string.IsNullOrEmpty(_root.SelectSingleNode(CASENUMBER, this.NamespaceManager).Value))
{
_caseNumber = Convert.ToInt32(_root.SelectSingleNode(CASENUMBER, this.NamespaceManager).Value);
submitVictimBasicInformation();
DataConnections["CaseSubmit"].Execute();
// uploadAttachmentInDocLib();
}
});
}
catch (Exception ex)
{
SPSecurity.RunWithElevatedPrivileges(delegate()
{
HandleException(ex);
});
}
}
private void submitVictimBasicInformation()
{
try
{
SPSite site = SPContext.Current.Site;//new SPSite("http://pro1/sites/cms/");
using (SPWeb spWeb = site.OpenWeb())
{
spWeb.AllowUnsafeUpdates = true;
//WriteLog("submitVictimBasicInformation : Start");
//SPList victimBasicInfoList = VictimBasicInformationList;
SPList victimBasicInfoList = spWeb.Lists["VictimBasicInformationList"];
SPListItemCollection oldListItemColl;
oldListItemColl = getSPListItemCollection(_caseNumber, victimBasicInfoList);
List<int> lstID = getSPListItemIDs(oldListItemColl);
XPathNodeIterator rows = _root.Select("/my:myFields/my:group7/my:VictimsInformationRepeating", NamespaceManager);
while (rows.MoveNext())
{
SPListItem objListItem = victimBasicInfoList.Items.Add();
objListItem["CaseNumber"] = _caseNumber;
objListItem["Name"] = rows.Current.SelectSingleNode("my:VictimsName", this.NamespaceManager).Value;
if (!string.IsNullOrEmpty(rows.Current.SelectSingleNode("my:VictimsDOB", this.NamespaceManager).Value))
objListItem["DateOfBirth"] = Convert.ToDateTime(rows.Current.SelectSingleNode("my:VictimsDOB", this.NamespaceManager).Value).Date;
objListItem["Sex"] = rows.Current.SelectSingleNode("my:Sex", this.NamespaceManager).Value;
objListItem["Nationality"] = rows.Current.SelectSingleNode("my:VNationality", this.NamespaceManager).Value;
objListItem["IdentificationType"] = rows.Current.SelectSingleNode("my:VIDType", this.NamespaceManager).Value;
objListItem["VictimID"] = rows.Current.SelectSingleNode("my:VictimID", this.NamespaceManager).Value;
objListItem["ContactInformation"] = rows.Current.SelectSingleNode("my:VContactInfo", this.NamespaceManager).Value;
objListItem["EmailID"] = rows.Current.SelectSingleNode("my:VEmail", this.NamespaceManager).Value;
objListItem["MaritalStatus"] = rows.Current.SelectSingleNode("my:VMaritalStatus", this.NamespaceManager).Value;
objListItem["HealthStatus"] = rows.Current.SelectSingleNode("my:VHealthStatus", this.NamespaceManager).Value;
objListItem["ProfessionType"] = rows.Current.SelectSingleNode("my:VProfession", this.NamespaceManager).Value;
objListItem["EducationType"] = rows.Current.SelectSingleNode("my:VEducation", this.NamespaceManager).Value;
objListItem["AccomodationType"] = rows.Current.SelectSingleNode("my:VAccommodationType", this.NamespaceManager).Value;
objListItem["AccomodationDetails"] = rows.Current.SelectSingleNode("my:VictimsAccomodationAddress", this.NamespaceManager).Value;
objListItem.Update();
}
deleteSPListItems(oldListItemColl, lstID);
spWeb.AllowUnsafeUpdates = false;
}
//WriteLog("submitVictimBasicInformation : END");
}
catch
{
throw;
}
}
}
}
Thanks & Best Regards,
Hope this helps you to some extent...