次の方法で共有


_XDocumentEventSink2_Event.OnMergeRequest Event

Occurs when the merge operation is invoked either from the Microsoft InfoPath 2010 user interface or from the command line by using the /aggregate option.

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

Syntax

'Declaration
Event OnMergeRequest As _XDocumentEventSink2_OnMergeRequestEventHandler
'Usage
Dim instance As _XDocumentEventSink2_Event
Dim handler As _XDocumentEventSink2_OnMergeRequestEventHandler

AddHandler instance.OnMergeRequest, handler
event _XDocumentEventSink2_OnMergeRequestEventHandler OnMergeRequest

Remarks

If the ReturnStatus property of the MergeEventObject object is set to false, InfoPath cancels the merge operation. If an error occurs in the code for the OnMergeRequest event, InfoPath ignores the error and relies on the ReturnStatus property If the ReturnStatus property is not explicitly set, the default value of false is used.

For InfoPath forms stored in a Windows SharePoint Services form library, the OnMergeRequest event also occurs when the MergeDocuments2 method of the OpenXMLDocuments control is executed. For more information on the OpenXMLDocuments control, see the Microsoft SharePoint Products and Technologies 2003 Software Development Kit, which is available on the Microsoft Developer Network (MSDN) web site (https://msdn.microsoft.com/).

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.

Examples

In the following example, the OnMergeRequest event handler performs a merge operation, and it sets variables to indicate the status of the merge operation:

private bool _merging = false;

[InfoPathEventHandler(EventType=InfoPathEventType.OnMergeRequest)]
public void OnMergeRequest(MergeEvent e)
{ 
 // Set global property to indicate that forms are being merged.
 if (e.Index == 0)
 {
  _merging = true;
 }

 thisXDocument.ImportDOM(e.DOM);
 e.ReturnStatus = true;
  
 if ((e.Index + 1) == e.Count)
 {
  _merging = false;
  thisXDocument.UI.Alert("Your request to merge " + e.Count + " files is now complete.");
 }
}

See Also

Reference

_XDocumentEventSink2_Event Interface

_XDocumentEventSink2_Event Members

Microsoft.Office.Interop.InfoPath.SemiTrust Namespace