Hello , I have infopath form that use webservices to save data into sql server.I have published this form to my sharepoint form library. when i insert data it save into SQL server. But how can i display those data into sharepoint list. Can ny one please help me.
We were able to accomplish this for a client through a workflow. We saved the form to SharePoint and then grabbed the XML and pushed it into SQL. One of the good things about this is you can store only the fields you absolutely need in SQL.
Quick how-to:
- Change the form to submit to SharePoint.
- Promote the fields you wish to see in SharePoint more on field promotion
Create a new SharePoint workflow set to start on create or update and implement the following code:
public Guid workflowId = default(System.Guid); public SPWorkflowActivationProperties workflowProperties = new SPWorkflowActivationProperties();
private void onWorkflowActivated_Invoked(object sender, ExternalDataEventArgs e) { if (workflowProperties.Item.File.Exists) { // get file contents string contents; using (StreamReader reader = new StreamReader(workflowProperties.Item.File.OpenBinaryStream())) { contents = reader.ReadToEnd(); } string fileName = Path.GetFileNameWithoutExtension(workflowProperties.Item.File.Name); } }
The code above will produce the entire contents of the XML file as well as the file name. Whether you use code to get specific values or pass the entire XML string to SQL is up to you at this point. One thing that I would recommend is using SharePoint's unique ID to identify the record in SQL. This will allow you to synchronize any CRUD operation on the SharePoint record to the SQL record.