Application.RegisterFormTemplate method (String, String)
Installs the specified form template with the option to overwrite the previous registration record for the form template.
Assembly: Microsoft.Office.InfoPath (in Microsoft.Office.InfoPath.dll)
- Type: System.String
Specifies the Uniform Resource Locator (URL) of the form template. This parameter can be specified as a form definition (.xsf) file or a form template (.xsn) file.
- Type: System.String
Specifies how the form template is to be installed. The default value is "overwrite". The only other valid value for this parameter is "new-only".
The form template file cannot be found.
The parameters passed to this method are a null reference (Nothing in Visual Basic).
The parameters passed to this method are not valid. For example, they are of the wrong type or format.
If the form template has already been registered, and "new-only" is specified for the behavior parameter, the RegisterFormTemplate method will return an error. If "overwrite" is specified, the form template's registration record will be overwritten.
This member can be accessed only by forms opened from a form template that has been configured to run with full trust using the Security and Trust category of the Form Options dialog box. This member requires full trust for the immediate caller and cannot be used by partially trusted code. For more information, see "Using Libraries from Partially Trusted Code" on MSDN.
This type or member can be accessed only from code running in forms opened in Microsoft InfoPath Filler.
In the following example, the RegisterFormTemplate method of the Application class is used in a function to install a form template. The example assumes that there is a using or Imports statement for the Microsoft.Office.InfoPath namespace in the declarations section of the class that contains the function, and that the Microsoft InfoPath 3.0 Type Library is referenced on the COM tab of the Add Reference dialog box in Visual Studio.
for reading from the value specified for formTemplateLocation. Associated enumerations: FileIOPermissionAccess.Read
for writing to the path where form templates are installed. Associated enumerations: RegistryPermissionAccess.Write
for reading and writing to the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\InfoPath\SolutionsCatalog key in the registry. Associated enumerations: RegistryPermissionAccess.Read, RegistryPermissionAccess.Write