_XDocumentEventSink2_Event.OnAfterImport event

Office 2013 and later

Occurs after the import (or merge) operation has successfully completed.

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

event _XDocumentEventSink2_OnAfterImportEventHandler OnAfterImport

This event handler does not allow users to cancel an operation.

If the merge operation includes merging multiple forms, the OnAfterImport event occurs only after all forms have been merged and the complete operation is successful.

NoteNote

There is no user interface (UI) in the InfoPath form design window for creating this event handler. To add this event handler to the project, include the InfoPathEventHandler attribute as it appears in the example.

NoteNote

If you create an event handler for the OnAfterImport event of a form template, you must edit the form definition file (.xsf) to set the useScriptHandler attribute of the importParameters element to "yes" before it will run.

In the following example, the OnAfterImport event handler is used to display a message box that informs the user that the merge operation completed successfully:

[InfoPathEventHandler(EventType=InfoPathEventType.OnAfterImport)]
public void OnAfterImport(DocEvent e)
{
  thisXDocument.UI.Alert("Merge operation was successful.");
}
Show: