SubmitToHostAdapterObject Interface

Office 2010

Represents a connection for submitting data to a hosting environment.

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

public interface SubmitToHostAdapterObject : SubmitToHostAdapter

This type is a wrapper for a coclass that is required by managed code for COM interoperability. Use this type to access the members of the COM interface implemented by this coclass. For information about the COM interface, including a link to descriptions of its members, seeSubmitToHostAdapter.

This type of connection is used in a form template that is opened by an application that is hosting the InfoPath form editing environment as a control. For information about hosting InfoPath as a control, including information on how to create a method to handle the event for submitting a form in your host application’s code, see the MSDN article Hosting the InfoPath Form Editing Environment in a Custom Windows Form Application.

To create a data connection for submitting data to a hosting environment that can be referenced from business logic in a form template, use the Data Connections command on the Tools menu. For information on how to create an event handler that will run when the OnSubmitRequest event is raised, see How to: Add an Event Handler Using the InfoPath 2003 Object Model.

The following example shows a pattern for writing code that will perform custom actions in a form template's business logic before the form is submitted.

[InfoPathEventHandler(EventType = InfoPathEventType.OnSubmitRequest]
public void FormEvents_OnSubmitRequest(DocReturnEvent e)
   // Get the data adapter defined in the form template from the 
   // DataAdapters collection and cast to the SubmitToHostAdapter
   // type.
   SubmitToHostAdapter submitAdapter = 

   // Write code here to do custom actions that are not 
   // supported by rules or other declarative settings.  

   // Execute the submit operation against the adapter.