|InfoPath Developer Reference|
Version Added: InfoPath 2003
expression An expression that returns a XDocument object.
This event handler allows users to cancel an operation.
During the OnVersionUpgrade event, the form's underlying XML document is placed in read-only mode, and it is not validated against the form's associated XML Schema. If the ReturnStatus property of the VersionUpgradeEvent object is set to False, InfoPath cancels the opening of the form. If an error occurs in the scripting code for the OnVersionUpgrade event handler, InfoPath ignores it and relies on the ReturnStatus property of the VersionUpgradeEvent object. If the ReturnStatus property is not explicitly set, the default value of True is used.
In the following example, the OnVersionUpgrade event handler is used to determine whether the form with the incorrect older version number contains an EmailAddress element. If it does not, one is added.