views:

2352

answers:

4

Is it possible to fill out an infopath form and submit it via a C# console application?

If yes, then how?

+2  A: 

Yes, you can create a XML file within your C# application and push it to your Sharepoint Form Library. Sharepoint won't realize any difference.

Just ensure two things:

  • Your XML must validate against the Infopath schema.
  • Remember to add the XML processing instructions, so that Sharepoint and Infopath know how to handle the XML file. (Simply 'steal' it from an Infopath generated XML.)
MrFox
A: 

How can we read infopath file contents using C#? Do you guys know how to do that? Ive been reading all over the place, but i couldn't find something helpful.. your help is much appreciated.

A: 

Hi I am able to create the XML programatically and when Opened in InfoPath, it show all fields correctly but when I try to submit it. It fails and throws some SOAP Exception. What may be the issue?

You might want to start a new question, since it looks like you're giving an answer. :(
Sean Ochoa
A: 

MrFox is right, an Infopath Form is just an Xml document that conforms to certain rules, so as long as you create the text file with the correct Xml markups, then you've created an Infopath doc. There are, however, programmatical ways to manipulate a document using the Infopath space. In particular, you can create a new Infopath document from an Infopath template. Lookup more information on XDocuments2.NewFromSolution() to see some examples.

Henry