편집

다음을 통해 공유


SubmitToHostAdapterObject Interface

Definition

Represents a connection for submitting data to a hosting environment.

public interface class SubmitToHostAdapterObject : Microsoft::Office::Interop::InfoPath::SubmitToHostAdapter
[System.Runtime.InteropServices.Guid("096CD739-0786-11D1-95FA-0080C78EE3BB")]
public interface SubmitToHostAdapterObject : Microsoft.Office.Interop.InfoPath.SubmitToHostAdapter
type SubmitToHostAdapterObject = interface
    interface SubmitToHostAdapter
Public Interface SubmitToHostAdapterObject
Implements SubmitToHostAdapter
Derived
Attributes
Implements

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

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.

Properties

Name

Gets the name of the data adapter that the SubmitToHostAdapter object represents.

(Inherited from SubmitToHostAdapter)
QueryAllowed

The QueryAllowed property is available for the SubmitToHostAdapter object but, because the SubmitToHostAdapter object is available for submitting data only, the property always returns false.

(Inherited from SubmitToHostAdapter)
SubmitAllowed

The SubmitAllowed property is available for the SubmitToHostAdapterr object but, because the SubmitToHostAdapter object is available for submitting data only, the property always returns true.

(Inherited from SubmitToHostAdapter)

Methods

Query()

The Query method is available for the SubmitToHostAdapter object but, because the SubmitToHostAdapter object is available for submitting data only, the method will always generate a run-time error when it is called on that object.

(Inherited from SubmitToHostAdapter)
Submit()

Executes the submit operation on the SubmitToHostAdapter object.

(Inherited from SubmitToHostAdapter)

Applies to