Save form locally - InfoPath Dev
in

InfoPath Dev

Save form locally

Last post 02-15-2010 01:28 AM by Irianna. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 02-12-2010 08:01 AM

    Save form locally

    Hi Folks,

    I'm in need of a littlehelp.

    I've got a form that submits to a SQL Database, its working perfectly fine - however, I need to get the form to work on handheld devices that are not connected to the network.

    What i'd like, is a custom button on the last view that saves the for to the C:\ as a .xml file so that when they come back onlne they can run a script i have that will open up and submit the forms.

    So, I've got the button and i've got some code behind it that saves the form to the local drive. The part i'm stuck on, is giving the saved form a unique name.

    the code i'm using is              this.SaveAs("C:\\SavedForm.xml");

    Thank in advance for any help you can offer.

    Iri.

     

     

    -------
  • 02-12-2010 08:28 AM In reply to

    If you need a uniuqe name you could generate a GUID using code or you could generate a unique name but concatenating some of the fields in the form with a data/time stamp, that should end up being pretty unique as one of the timestamps in InfoPath is to the milisecond

     Hope that helps!

    Ted

  • 02-12-2010 08:32 AM In reply to

    Ye thats what I want, just not sure how :(

    -------
  • 02-12-2010 08:36 AM In reply to

    Our qRules product has a function built in that lets you easily create a GUID: http://www.qdabra.com/en/products/qRules.aspx

    We've already done the code for you.

  • 02-15-2010 01:28 AM In reply to

    Thanks, I've managed to get it to work now with the code

     XmlDocument oDOM = new XmlDocument();

    Microsoft.Office.Interop.InfoPath.SemiTrust.IXMLDOMDocument oWrappedDOM = thisXDocument.DOM;

    oDOM.PreserveWhitespace = true;

    oDOM.LoadXml(oWrappedDOM.xml);

    oDOM.Save("C:\\Submit\\Form_"

    + DateTime.Now.ToString("yyyy.MM.dd_HH.mm.ss.ff") + ".xml");

     

    I just need now to close the form and open a clean form up.

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