tags:

views:

54

answers:

1

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.

A: 

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:

  1. Change the form to submit to SharePoint.
  2. Promote the fields you wish to see in SharePoint more on field promotion
  3. 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.

knight0323
Hello, Thanks for your answer. How could we do that? Can you please elaborate or give me demo code for the same? my id is [email protected]. Thank you.
My scenario is something different. I have already created one webservices for my infopath form. I have published this form to the sharepoint library. When i insert data into browser enable form it will store in SQL server. Now i want to display this data into sharepoint list or library. please ny one can help me out. Thank you.
If you just want a second list or view, you can look into BDC if you have enterprise 2007 or External Lists if you're on 2010 (any version). Otherwise, you could do a web part to display the data.
knight0323
Using BDC only i can view the list in sharepoint. Please give me reference about second submit option in Infopath. Thank you.
see the original comment
knight0323