问题
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:
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.
回答2:
Here's an article about finding the install path for Office Apps:
http://support.microsoft.com/kb/234788
回答3:
Try using browser based form and querystring instead
来源:https://stackoverflow.com/questions/81556/launch-infopath-form-with-parameter