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.
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);
int num = 0;
string fileName = num.ToString();
e.CancelableArgs.Cancel = false;
//need to get data here and save it using streamWriter
//using (StreamWriter writer = new StreamWriter(saveFileLocally.FileName))
//writer.WriteLine("File Saved Successfully");//just printing this message in the file
The message boxes are there for debugging purposes.
Thanks a lot.