Share via


SubmitToHostAdapterObject interface

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)

Syntax

'Declaration
<GuidAttribute("096CD739-0786-11D1-95FA-0080C78EE3BB")> _
Public Interface SubmitToHostAdapterObject _
    Inherits SubmitToHostAdapter
'Usage
Dim instance As SubmitToHostAdapterObject
[GuidAttribute("096CD739-0786-11D1-95FA-0080C78EE3BB")]
public interface SubmitToHostAdapterObject : SubmitToHostAdapter

Remarks

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.

Examples

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 = 
      (SubmitToHostAdapter)(DataAdapters["MyHostAdapter"]);

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

   // Execute the submit operation against the adapter.
   submitAdapter.Submit();
<InfoPathEventHandler(EventType := InfoPathEventType.OnSubmitRequest)>
Public Sub FormEvents_OnSubmitRequest(ByVal e As DocReturnEvent)
   ' Get the data connection defined in the form template from the
   ' DataAdapters collection and cast to the SubmitToHostAdapter
   ' type.
   Dim submitAdapter As SubmitToHostAdapter = _
      DirectCast(DataAdapters("MyHostAdapter"), _
      SubmitToHostAdapter)

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

   ' Execute the submit operation against the connection.
   submitAdapter.Submit()
End Sub

See also

Reference

SubmitToHostAdapterObject members

Microsoft.Office.Interop.InfoPath namespace