_XDocumentEventSink2_Event.OnAfterImport Event

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)

Syntax

'Declaration
Event OnAfterImport As _XDocumentEventSink2_OnAfterImportEventHandler
'Usage
Dim instance As _XDocumentEventSink2_Event
Dim handler As _XDocumentEventSink2_OnAfterImportEventHandler

AddHandler instance.OnAfterImport, handler
event _XDocumentEventSink2_OnAfterImportEventHandler OnAfterImport

Remarks

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.

Note

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.

Note

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.

Examples

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.");
}

See Also

Reference

_XDocumentEventSink2_Event Interface

_XDocumentEventSink2_Event Members

Microsoft.Office.Interop.InfoPath.SemiTrust Namespace