views:

640

answers:

3

Opening an Infopath form with parameter can be done like this:

System.Diagnostics.Process.Start(PathToInfopath + "infopath.exe", "Template.xsn /InputParameters Id=123");

But that requires I know the path to Infopath.exe which changes with each version of Office. Is there a way to simply launch the template and pass a parameter? Or is there a standard way to find where Infopath.exe resides?

+1  A: 

Play around with System.Diagnostics.ProcessStartInfo which allows you to specify a file you wish to open and also allows you to specify arguments.

You can then use Process.Start(ProcessStartInfo) to kick off the process. The framework will determine which application to run based on the file specified in the ProcessStartInfo.

I don't have Infopath installed so I unfortunately can't try it out. But hopefully it helps you out a little.

Steve
+1  A: 

Here's an article about finding the install path for Office Apps:

http://support.microsoft.com/kb/234788

bryansh
A: 

Try using browser based form and querystring instead

Jason Watts