Launch Infopath form with parameter

空扰寡人 提交于 2020-01-03 05:28:27

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!