Application.UnregisterFormTemplate Method
Uninstalls the specified form template.
Namespace: Microsoft.Office.InfoPath
Assembly: Microsoft.Office.InfoPath (in Microsoft.Office.InfoPath.dll)
Syntax
'Declaration
Public MustOverride Sub UnregisterFormTemplate ( _
formTemplateLocation As String _
)
'Usage
Dim instance As Application
Dim formTemplateLocation As String
instance.UnregisterFormTemplate(formTemplateLocation)
public abstract void UnregisterFormTemplate(
string formTemplateLocation
)
Parameters
formTemplateLocation
Type: System.StringSpecifies the Uniform Resource Identifier (URI) of the form template.
Exceptions
Exception | Condition |
---|---|
FileNotFoundException | The form template file cannot be found. |
ArgumentNullException | The parameter passed to this method is a null reference (Nothing in Visual Basic). |
ArgumentException | The parameter passed to this method is not valid. For example, it is of the wrong type or format. |
Remarks
If the form template cannot be uninstalled, the UnregisterFormTemplate method will raise an exception.
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.
Examples
In the following example, the UnregisterFormTemplate method of the Application class is used in a function to uninstall the specified 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.
public void UninstallForm()
{
Microsoft.Office.InfoPath.Application infoPathApp =
new Microsoft.Office.InfoPath.Application();
infoPathApp.UnregisterFormTemplate(@"C:\My Forms\MyFormTemplate.xsn");
}
Public Sub UninstallForm()
Dim infoPathApp As Microsoft.Office.InfoPath.Application = _
new Microsoft.Office.InfoPath.Application()
infoPathApp.UnregisterFormTemplate("C:\My Forms\MyFormTemplate.xsn")
End Sub