_Application3.RegisterSolution 方法 (String, String)

安装指定的表单模板。

命名空间:  Microsoft.Office.Interop.InfoPath.SemiTrust
程序集:  Microsoft.Office.Interop.InfoPath.SemiTrust(位于 Microsoft.Office.Interop.InfoPath.SemiTrust.dll 中)

语法

声明
Sub RegisterSolution ( _
    bstrSolutionURL As String, _
    bstrBehavior As String _
)
用法
Dim instance As _Application3
Dim bstrSolutionURL As String
Dim bstrBehavior As String

instance.RegisterSolution(bstrSolutionURL, _
    bstrBehavior)
void RegisterSolution(
    string bstrSolutionURL,
    string bstrBehavior
)

参数

  • bstrSolutionURL
    类型:System.String

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

  • bstrBehavior
    类型:System.String

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

实现

_Application2.RegisterSolution(String, String)

备注

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

重要

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

示例

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

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

备注

上面的示例假定正在使用 Microsoft.Office.Interop.InfoPath 命名空间并引用 Microsoft InfoPath 3.0 类型库。

另请参阅

引用

_Application3 接口

_Application3 成员

RegisterSolution 重载

Microsoft.Office.Interop.InfoPath.SemiTrust 命名空间