XDocument.Extension Property

InfoPath Developer Reference

A read-only property that returns a reference to the global scripting object, which exposes the functions and global variables contained in a Microsoft Office InfoPath 2007 form's primary scripting file. Read-only

Version Information
 Version Added:  InfoPath 2003

Syntax

expression.Extension

expression   An expression that returns a XDocument object.

Return Value
Object

Remarks

The Extension property facilitates using the functions and global variables implemented in an InfoPath form's scripting file. Usually, it is used from a custom task pane, from a custom dialog box, or in the XSL Transformation (XSLT) of a view where direct access to the functions and variables may be needed.

For example, if you were to declare a global variable in your scripting file such as the following,

JScript
  var constCity = "Redmond";

You could access that value in the code of your custom task pane or dialog box by using the Extension property, as shown here:

JScript
  XDocument.Extension.constCity;

To use the Extension property within a custom task pane, you must first set a reference to the XDocument object by using the Dynamic HTML (DHTML) external property of the DHTML window object, as shown in this example:

JScript
  objXDocument = window.external.XDocument;

Security Level 2: Can be accessed only by forms running in the same domain as the currently open form, or by forms that have been granted cross-domain permissions.

Example

In the following example, the Extension property of the XDocument object is used to access a custom function:

JScript
  objXDocument = window.external.XDocument;
objXDocument.Extension.MyCustomFunction();

See Also