Share via


_ExternalApplication.Close Method

Closes the specified Microsoft InfoPath 2010 form.

Namespace:  Microsoft.Office.Interop.InfoPath.SemiTrust
Assembly:  Microsoft.Office.Interop.InfoPath.SemiTrust (in Microsoft.Office.Interop.InfoPath.SemiTrust.dll)

Syntax

'Declaration
Sub Close ( _
    bstrDocumentURI As String _
)
'Usage
Dim instance As _ExternalApplication
Dim bstrDocumentURI As String

instance.Close(bstrDocumentURI)
void Close(
    string bstrDocumentURI
)

Parameters

  • bstrDocumentURI
    Type: System.String

    The string value that specifies the Uniform Resource Identifier (URI) of a form.

Remarks

The Close method closes the currently open form without quitting the InfoPath application. When using the Close method, the form is closed unconditionally, meaning that any changes made to the data in the form are not saved.

Important

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.

Examples

In the following example, which is written in the C# programming language, the Close method of the ExternalApplication object is used to close the currently open form:

private void AutomateInfoPathForm()
{
 ExternalApplication infoPath = new ExternalApplicationClass();
 // Open an InfoPath form.
 infoPath.Open(@"C:\My Forms\Form1.xml", 1);
 // Close the InfoPath form.
 infoPath.Close(@"C:\My Forms\Form1.xml");
 // Quit the InfoPath application.
 infoPath.Quit();
}

Note

The above example assumes that the Microsoft.Office.Interop.InfoPath namespace is being used and that the Microsoft InfoPath 3.0 Type Library is referenced.

See Also

Reference

_ExternalApplication Interface

_ExternalApplication Members

Microsoft.Office.Interop.InfoPath.SemiTrust Namespace