Save form Locally (Offline) - InfoPath Dev
in

InfoPath Dev

Save form Locally (Offline)

Last post 04-11-2017 07:27 AM by dcmk07. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 03-20-2017 08:21 AM

    • srg88
    • Not Ranked
    • Joined on 03-16-2017
    • Posts 2

    Save form Locally (Offline)

    I need the ability to save filled out forms locally to people's laptops/tablets while out in the field (offline), then submit the forms when they are back in the office (attached to the network). In my InfoPath 2013 I created the form and added a "Save" button to the form. I added the following code to that Save button: _____________________________________ if(this.New) { this.SaveAs("c:\\forms\\form1.xml"); } else { this.Save(); } _____________________________________ This code works... and creates a file called "form1.xml" when the Save button is clicked. The problem I'm having is how do I save the form with a unique filename each time so that users are not over-writing the same filename over and over? The second problem (which I haven't figured out yet) is that in preview mode in Infopath, I can click on the save button and it creates the form file with no problem or errors. When I fill out the form using InfoPath filler and click on the Save button I created, it gives me a bunch of security errors, and won't create the file. Any help or suggestions would be greatly appreciated.
  • 03-21-2017 07:59 AM In reply to

    Re: Save form Locally (Offline)

     You'll need to make the form full trust and sign it with a code signing cert (I have one I use that doesn't expire till 2036 & I am happy to share it with you). You can use a field value or something to make the name dynamic, or just maybe use a date time string? Like:

    string filename = DateTime.Now.ToString("yyyyMMDDHHmm");
    this.SaveAs(string.Format("c:\\forms\\{0}.xml", filename));

     

    Hilary Stoupa

  • 04-10-2017 12:48 AM In reply to

    • dcmk07
    • Not Ranked
    • Joined on 04-04-2017
    • Posts 2

    Re: Save form Locally (Offline)

    Hilary Stoupa:

     You'll need to make the form full trust and sign it with a code signing cert (I have one I use that doesn't expire till 2036 & I am happy to share it with you). You can use a field value or something to make the name dynamic, or just maybe use a date time string? Like:

    string filename = DateTime.Now.ToString("yyyyMMDDHHmm");
    this.SaveAs(string.Format("c:\\forms\\{0}.xml", filename));

     

    Hi Hilary, I am in exactly the same situation as srg88, was just wondering whether it would be possible to take advantage of your extremely generous offer? Dale
  • 04-10-2017 06:39 AM In reply to

    Oh you bet! I've attached a zip folder with the signing cert & instructions. :)
    Hilary Stoupa

  • 04-11-2017 07:27 AM In reply to

    • dcmk07
    • Not Ranked
    • Joined on 04-04-2017
    • Posts 2

    Re: Save form Locally (Offline)

    That is brilliant and so very generous! Many thanks for your help with this!
Page 1 of 1 (5 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.