|InfoPath Developer Reference|
Version Added: InfoPath 2003
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.
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.
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:
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.
Using the Application object
The Application object contains the following methods that can be used within InfoPath:
|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.|
The Application object contains the following methods that can be used for external automation:
|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 2007 application.|
|RegisterSolution||Installs the specified Microsoft Office InfoPath form template.|
|UnregisterSolution||Uninstalls the specified Office InfoPath 2007 form template.|
The XDocuments collection contains the following additional methods that can be used for external automation:
|Close||Closes the specified Office InfoPath 2007 form.|
|New||Creates a new Office InfoPath 2007 form based on the specified form.|
|NewFromSolution||Creates a new Office InfoPath 2007 form based on the specified form template.|
|NewFromSolutionWithData||Creates a new Office InfoPath 2007 form using the specified XML data and form template.|
|Open||Opens the specified Office InfoPath 2007 form.|
Although the ExternalApplication object is deprecated, 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.