To do this you need to ensure that the project properties on the infopath VSTA editor under Build > Advanced are set to full for debug.
Then after uploading, deploying, activating the form template as usual, copy the FormCode.cs file to your WFE. Open it in Visual Studio, attach to the correct w3wp worker process and debugging should work. Happy Days!
If your using InfoPath 2013 and come across this error when trying to access developer tools, its because this version of VSTA copies the code to a temp folder then then works on it there.
Problem is that temp folder are exactly that… “temp” so if the folder is lost then InfoPath will complain it cant find it.
The way around this is on the developer tab on the ribbon, click ‘Language’, click remove code (dont worry it wont delete your code).
Then click on ‘Code Editor’ again and it will make a new folder for your code in Documents > InfoPath Projects. Overwrite the contents of this new folder with the contents from the original project.
Then in VSTA look at the project properties and you will see the link to the temp folder. Open that folder, overwrite the contents of that also as before.
If you get this error:
The form cannot be submitted to the Web server either because your computer is offline or because the host server is currently unavailable. If this problem persists, contact your network administrator.
you need to open the form inside the network, right click ‘view source’ and search for “g_objCurrentFormData”.
You’ll see something like:
You need to add a link translation to:
There’s lots of tutorials showing how to programmatically fill in a repeating section or table in infopath using C#. However I only found one that shows how to do this without losing formulas, formatting and validation on the controls.
The process is to clone the first row in the repeating table instead of creating new ones.
Link here: http://sharepoint.orcinus-orca.eu/archives/17