Show All

# Application Object

Application

Represents the Microsoft Office InfoPath 2003 application. The Application object includes properties and methods that return references to the high-level objects of the InfoPath object model. For example, the XDocuments property returns a reference to a collection of XDocument objects.

## Remarks

The Application object is the top-level object in the InfoPath object model, and it provides a number of properties and methods that can be used to access lower-level collections and objects in the object model, and to perform a variety of general purpose functions.

## Using the Application object

The Application object can be used directly in scripting code as in the following Microsoft JScript example, which uses the Alert method of the UI object, accessed through the XDocument object, to display a message box that indicates the version number of the current instance of InfoPath:

    XDocument.UI.Alert("Application version: " + Application.Version);

Note that the XDocument property was not qualified with the name of the Application object. This is because both the Application object and the XDocument object are embedded directly in the InfoPath script engine, and therefore they do not have to be explicitly declared. However, they do need to be declared when used in an expression or argument, as the example above demonstrates.

Note The Application object contains the following methods that can be used within InfoPath:

Method | Description
--- | ---
FormatString | Formats the specified string or XML node according to the specified category and options parameters.
IsDestinationReachable | Returns a Boolean value indicating whether the specified Uniform Resource Locator (URL), universal naming convention (UNC) path, or IP address of the destination computer can be connected to from the client computer.
NewADODBConnection | Creates and returns a reference to an empty ActiveX Data Objects (ADO) Connection object.
NewADODBRecordset | Creates and returns a reference to an empty ActiveX Data Objects (ADO) Recordset object.

Note The Application object contains the following methods that can be used for external automation:

Method | Description
--- | ---
CacheSolution | Examines the form template in the cache and, if necessary, updates it from the published location of the form template.
Quit | Quits the Microsoft Office InfoPath 2003 application.
RegisterSolution | Installs the specified Microsoft Office InfoPath form template.
UnregisterSolution | Uninstalls the specified Microsoft Office InfoPath 2003 form template.

The XDocuments collection contains the following additional methods that can be used for external automation:

Method | Description
--- | ---
Close | Closes the specified Microsoft Office InfoPath 2003 form.
New | Creates a new Microsoft Office InfoPath 2003 form based on the specified form.
NewFromSolution | Creates a new Microsoft Office InfoPath 2003 form based on the specified form template.
NewFromSolutionWithData | Creates a new Microsoft Office InfoPath 2003 form using the specified XML data and form template.
Open | Opens the specified Microsoft Office InfoPath 2003 form.

Although the ExternalApplication object is deprecated in Microsoft Office InfoPath 2003 Service Pack 1, replaced with the methods in the above tables, ExternalApplication methods are still available for backward compatibility.

For more information about using the Application object, see Accessing application data.

©2003-2004 Microsoft Corporation. All rights reserved. Permission to copy, display and distribute this document is available at: http://msdn.microsoft.com/library/en-us/odcXMLRef/html/odcXMLRefLegalNotice.asp