Open form in a different form template - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Open form in a different form template

Last post 03-30-2009 12:21 PM by chrisf. 0 replies.
Page 1 of 1 (1 items)
Sort Posts: Previous Next
  • 03-30-2009 12:21 PM

    • chrisf
    • Not Ranked
    • Joined on 11-06-2008
    • Posts 3

    Open form in a different form template

    I am saving my infopath forms in a sql database and am retrieving them by following this article by S.Y.M. Wong-A-Ton:
    http://www.bizsupportonline.net/infopath2007/retrieve-infopath-form-sql-display-in-new-instance-infopath.htm.


    This is working great, but some users should only be able to view the forms and not add/modify them. I am hoping there is a way to launch the form using a different template or view that is an exact copy of the one that added the form except it does not allow a submit.


    This is the code that opens the form in the submitform.xsn

    // Convert the XML data for the InfoPath form into a byte array
    byte[] bytes = Encoding.UTF8.GetBytes(data);

    // Create a temp file
    string fileName = Path.GetTempFileName();

    // Read the byte array of the retrieved form into the temp file
    using (FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.ReadWrite))
    {
    fs.Write(bytes, 0, bytes.Length);
    fs.Flush();
    fs.Close();
    }

    // Display the form in a new instance of InfoPath
    this.Application.XmlForms.Open(fileName, XmlFormOpenMode.Default);


    What do I need to replace this.Application.XmlForms.Open(fileName, XmlFormOpenMode.Default); with in order to open it in the nonsubmitform.xsn?

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