Edit

Share via


SubmitToHostConnection Class

Definition

Represents a connection for submitting data to a hosting environment.

public ref class SubmitToHostConnection abstract : Microsoft::Office::InfoPath::DataConnection
public abstract class SubmitToHostConnection : Microsoft.Office.InfoPath.DataConnection
type SubmitToHostConnection = class
    inherit DataConnection
Public MustInherit Class SubmitToHostConnection
Inherits DataConnection
Inheritance
SubmitToHostConnection

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.

public void FormEvents_Submit(object sender, SubmitEventArgs e)
{
   // Get the data connection defined in the form template from the 
   // DataConnections collection and cast to the SubmitToHostConnection
   // type.
   SubmitToHostConnection submitConnection = 
      (SubmitToHostConnection)(DataConnections["MyHostConnection"]);

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

   // Execute the submit operation against the connection.
   submitConnection.Execute();

}

Public Sub FormEvents_Submit(ByVal sender As Object, _
   ByVal e As SubmitEventArg)
   ' Get the data connection defined in the form template from the
   ' DataConnections collection and cast to the SubmitToHostConnection
   ' type.
   Dim submitConnection As SubmitToHostConnection = _
      DirectCast(DataConnections("MyHostConnection"), _
      SubmitToHostConnection)

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

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

Remarks

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 article titled 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 Data tab of the ribbon. For information on how to create an event handler that will run when the Submit event is raised, see How to: Add an Event Handler.

Constructors

SubmitToHostConnection()

Properties

Name

Gets the name of the data connection.

(Inherited from DataConnection)

Methods

Execute()

Depending on which ConnectionTypeConnection class it is called from, executes a submit or query operation on the data connection using the declaratively defined values for the submitted data, query parameters, or data to retrieve.

(Inherited from DataConnection)

Applies to