_Application3.RegisterSolution(String, String) 方法

定义

安装指定的表单模板。

public:
 void RegisterSolution(System::String ^ bstrSolutionURL, System::String ^ bstrBehavior);
public void RegisterSolution(string bstrSolutionURL, string bstrBehavior);
abstract member RegisterSolution : string * string -> unit
Public Sub RegisterSolution (bstrSolutionURL As String, bstrBehavior As String)

参数

bstrSolutionURL
String

指定表单模板的统一资源定位器 (URL)。 可以将此参数指定为表单定义 (.xsf) 文件或表单模板 (.xsn) 文件。

bstrBehavior
String

指定安装表单模板的方法。 默认值为“overwrite”。 此参数仅有两个有效值,另一个为“new-only”。

实现

示例

在以下 C# 示例中,对象的 RegisterSolution 方法 Application 用于安装表单模板:

public void InstallForm()
{
   Microsoft.Office.Interop.InfoPath.Application infoPath = 
      new Microsoft.Office.Interop.InfoPath.ApplicationClass();
   infoPath.<span class="label">RegisterSolution</span>(@"C:\MyFormTemplate.xsn", "overwrite");
}

注意:上述示例假定 Microsoft.Office.Interop.InfoPath 正在使用命名空间,并且引用了 Microsoft InfoPath 3.0 类型库。

在以下 C# 示例中,对象的 RegisterSolution 方法 Application 用于安装表单模板:

public void InstallForm()
{
   Microsoft.Office.Interop.InfoPath.Application infoPath = 
      new Microsoft.Office.Interop.InfoPath.ApplicationClass();
   infoPath.<span class="label">RegisterSolution</span>(@"C:\MyFormTemplate.xsn", "overwrite");
}

注意:上述示例假定 Microsoft.Office.Interop.InfoPath 正在使用命名空间,并且引用了 Microsoft InfoPath 3.0 类型库。

注解

如果表单模板已注册,并且为 bstrBehavior 参数指定了“new-only”, 则 RegisterSolution 方法将返回错误。 如果参数指定为“overwrite”,将覆盖表单模板的注册记录。

重要说明:此成员只能由已配置为使用“表单选项”对话框的“安全与信任”类别以完全信任方式运行的表单模板打开的表单访问。 此成员要求直接调用方的完全信任并且不能由部分信任的代码使用。 有关更多信息,请参阅 MSDN 上的“使用部分信任的代码中的库”。

适用于