Save the form locally - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Save the form locally

Last post 10-05-2016 07:29 AM by Hilary Stoupa. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 09-28-2016 07:56 AM

    Save the form locally

    I have been trying to work on the save feature of InfoPath forms and i am new to this environment. I have an Infopath form hosted on the Sharepoint site. The form needs to be saved after getting filled and then further distribute it so that other people can edit and save their copy. I want to have a Save As button so that user is able to save to a place where they want. I hit obstacles and i wasn't able to overcome (I lack experience). Problems listed below: 1. The save event handler in c# code requires the form to be filled in InfoPath Filler. Web browsers form do not support it (Found this yesterday so i can be wrong). 2. The save button is not shown on the form as i am trying to preview it or try to fill it on the server as well. So i created a submit button which is run by code as well and displaying a simple message right now. Yes the submit button is showing the message, but no save button is shown. Although i did say Save by code on the form options.(So i dont know why is it not wroking). 3. I did try to write a save code regardless and i am not able to test it. I am posting it below so that someone can have a look and tell me if it can support Save as Dialog box or not. (I am really new to this environment so please bear with me). I would really appreciate if someone can help me with this problem. I am happy to explain the problem in greater depth if need be, but i did outline the main obstacle. CODE: (may or may not work as i cant test because no "save" button is shown) public void FormEvents_Save_1(object sender, SaveEventArgs e) { // Write your code here. MessageBox.Show("1"); SaveFileDialog saveFileLocally = new SaveFileDialog(); saveFileLocally.Filter = "InfoPath Forms (*.xml)|*.xml"; // saveFileLocally.Title = "Save the form locally"; //if (saveFileLocally.ShowDialog() == DialogResult.OK) { //XDocument doc = new XDocument(0); //this.save(); MessageBox.Show("2"); int num = 0; num++; string fileName = num.ToString(); this.SetSaveAsDialogLocation(@"Libraries\\Documents\\"); this.SetSaveAsDialogFilename(fileName); e.PerformSaveOperation(); e.CancelableArgs.Cancel = false; MessageBox.Show("3"); //need to get data here and save it using streamWriter //using (StreamWriter writer = new StreamWriter(saveFileLocally.FileName)) // doc.Save(saveFileLocally.FileName); //writer.WriteLine("File Saved Successfully");//just printing this message in the file //XDocument.Save(saveFileLocally.FileName); } } The message boxes are there for debugging purposes. Thanks a lot.
    Filed under: , , , ,
  • 10-05-2016 07:29 AM In reply to

    With a browser form, I think you are limited to the site where the form is opened - and the default location is dictated by the SaveLocation URL parameter.
    Hilary Stoupa

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