DocActionEvent.Source property

Office 2013 and later

Gets a reference to the inner-most XML Document Object Model (DOM) node of a form's underlying XML document.

Namespace:  Microsoft.Office.Interop.InfoPath.SemiTrust
Assembly:  Microsoft.Office.Interop.InfoPath.SemiTrust (in Microsoft.Office.Interop.InfoPath.SemiTrust.dll)

IXMLDOMNode Source { get; }

After you have set a reference to the XML DOM node that the Source property returns, you can use any of the properties and methods that are supported by the XML DOM.

Important noteImportant

This member 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.

In the following example, the Source property of the DocActionEventObject object is used to display the source XML data of the inner-most XML Document Object Model (DOM) node of the form's underlying XML document, which contains the button:

[InfoPathEventHandler(MatchPath="ShowDocActionEventSource", EventType=InfoPathEventType.OnClick)]
public void ShowDocActionEventSource_OnClick(DocActionEvent e)
{
 thisXDocument.UI.Alert("Source: " + e.Source.xml);
}

In the following example, the Source property of the DocActionEventObject object is used to display the source XML data of the XML DOM node in a message box:

[InfoPathEventHandler(MatchPath="DocActionEventSource", EventType=InfoPathEventType.OnClick)]
public void DocActionEventSource_OnClick(DocActionEvent e)
{
 thisXDocument.UI.Alert("Source: " + e.Source.xml);
}
Show: