This documentation is archived and is not being maintained.

DocReturnEvent Object

Office 2007
An event object that is used during a Microsoft Office InfoPath 2007 load or submission event.

Version Information
 Version Added:  InfoPath 2003


The DocReturnEvent object provides the XDocument property that can be used within a load or submission event to programmatically interact with the data in a form's underlying XML document. It also provides the ReturnStatus property that is used to specify whether the event is successful.

The DocReturnEvent object is passed as a parameter to the OnLoad and OnSubmitRequest events of an InfoPath form. The properties that it provides are available only during these events.

For more information about using the DocReturnEvent object, see Responding to form events.


In the following example, the XDocument property of the DocReturnEvent object is used to display the source XML of a form's underlying XML document using the DOM property of the XDocument object:

function XDocument::OnLoad(eventObj)
   XDocument.UI.Alert("The source XML: " + eventObj.XDocument.DOM.xml);
   eventObj.ReturnStatus = true;