_ExternalApplication.RegisterSolution(String, String) 方法

定义

安装指定的 Microsoft InfoPath 表单模板。

public void RegisterSolution(string bstrSolutionURL, string bstrBehavior = "overwrite");
abstract member RegisterSolution : string * string -> unit
Public Sub RegisterSolution (bstrSolutionURL As String, Optional bstrBehavior As String = "overwrite")

参数

bstrSolutionURL
String

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

bstrBehavior
String

默认值是 overwrite。 用于指定安装表单模板的方法。 此参数的另一个有效值为 new-only

示例

在以下示例(以 C# 编程语言编写)中,对象的 RegisterSolution 方法 ExternalApplication 用于安装表单模板:

private void InstallForm()
{
 ExternalApplication infoPath = new ExternalApplicationClass();

 // Install the specified InfoPath form.
 infoPath.<span class="label">RegisterSolution</span>(@"C:\My Forms\MyFormTemplate.xsn", "overwrite");
}

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

在以下示例(以 C# 编程语言编写)中,对象的 RegisterSolution 方法 ExternalApplication 用于安装表单模板:

private void InstallForm()
{
 ExternalApplication infoPath = new ExternalApplicationClass();

 // Install the specified InfoPath form.
 infoPath.<span class="label">RegisterSolution</span>(@"C:\My Forms\MyFormTemplate.xsn", "overwrite");
}

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

注解

如果表单模板已注册,并且 仅新的 值用于 bstrBehavior 参数, 则 RegisterSolution 方法将返回错误。 如果使用 overwrite 值,则该表单模板的注册记录将被覆盖。

适用于