Submit Form data to Sharepoint - InfoPath Dev
in

InfoPath Dev

Submit Form data to Sharepoint

Last post 01-29-2007 06:57 AM by Afzal. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 01-23-2007 09:05 AM

    • Afzal
    • Not Ranked
    • Joined on 10-26-2006
    • USA
    • Posts 14

    Submit Form data to Sharepoint

    Is it possible to submit the partial data from an Infopath form to sharepoint form library?

    My scenario:

    I have a form which contains a repeating section for storing some data and when user click save/submit then I want to save the main form as well as create a sub form in the sharepoint form library.

    Any help is greatly appreciated.

    Thanks,

    Afzal
  • 01-24-2007 05:23 AM In reply to

    • Shiva
    • Top 25 Contributor
    • Joined on 04-15-2005
    • India
    • Posts 694

    Re: Submit Form data to Sharepoint

    Hi Afzal,

    We can submit the form using HTTPWebRequest. In below code you need to pass the two arguments.

    First one is destination url it should be point your sharepoint site and with file name like http://system1/abc.xml#%92. For every time submission you need to change your file name as per your requirement.

    Second one is your sub form xml string.

    //Save file using HTTPWebrequest
    private bool SaveFileToSharepoint(string destinationURL, xmlString)
    {
    byte[] bytes = System.Text.Encoding.UTF8.GetBytes(xmlString);
    HttpWebRequest request = (HttpWebRequest)WebRequest.Create(destinationURL);
    request.Method = "PUT";
    request.Credentials = System.Net.CredentialCache.DefaultCredentials;
    request.AllowWriteStreamBuffering = true;

    Stream stream = request.GetRequestStream();
    stream.Write(bytes, 0, bytes.Length);
    stream.Flush();
    stream.Close();

    HttpWebResponse response = null;
    try
    {
    response = (HttpWebResponse)request.GetResponse();
    }
    catch (WebException ex)
    {
    response = (HttpWebResponse)ex.Response;
    }

    if (response != null)
    {
    HttpStatusCode statusCode = response.StatusCode;
    response.Close();

    if(statusCode == HttpStatusCode.OK || statusCode == HttpStatusCode.Created)
    {
    return true;
    }
    else
    {
    return false;
    }
    }
    return false;
    }
  • 01-24-2007 07:06 AM In reply to

    • Afzal
    • Not Ranked
    • Joined on 10-26-2006
    • USA
    • Posts 14

    Re: Submit Form data to Sharepoint

    Hi Shiva,

    Thanks for your response, but I have another question regarding the sub form xml, how do I get the sub for xml. I know it sound stupid but I am stuck with this and really need your help.

    Your help is greatly appreciated.

    Thanks,

    Afzal
  • 01-24-2007 09:19 PM In reply to

    • Shiva
    • Top 25 Contributor
    • Joined on 04-15-2005
    • India
    • Posts 694

    Re: Submit Form data to Sharepoint

    Hi Afzal,

    As of your requirement sub form of is set of nodes right. You need to get the parent node of that group of nodes. After getting the node you need to get the xml using below the code.

    //Get the sub form node
    IXMLDOMNode subformNode = thisXDocument.DOM.selectSingleNode("XPath of your node");
    //Get XML string node
    string xmlStringNode = subformNode.xml;
  • 01-29-2007 06:57 AM In reply to

    • Afzal
    • Not Ranked
    • Joined on 10-26-2006
    • USA
    • Posts 14

    Re: Submit Form data to Sharepoint

    Hi Shiva,

    Thanks for your reply, I have a question regarding the HTTPWebRequest, Can we write (translate) the code in jScript?

    Thanks once again,

    -Afzal
Page 1 of 1 (5 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.