Show All

# EmailAdapter Object

Represents the data adapter for submitting form information in e-mail by using Microsoft Office Outlook.

## Remarks

Note This object model member is not supported when the Disable Service Pack features option on the Advanced tab of the Options dialog box in InfoPath is selected or when Microsoft Office 2003 Service Pack 1 or later is not installed. Any form that implements this object model member in its code will generate an error message if it is opened in InfoPath when service pack features are disabled or unavailable.

## Using the EmailAdapter object

Use the Item property of the DataAdapters collection to return an EmailAdapter object.

In the following example, a reference to the EmailAdapter object is set by passing the name of the EmailAdapter object to the Item property of the DataAdapters collection:

    var objEmailAdapter;
    objEmailAdapter = XDocument.DataAdapters("Main Submit");

After the reference has been set, you can use the properties of the EmailAdapter object as shown in the following example, which sets the To properties and the Subject property, then submits the form.

    objEmailAdapter.To = "list@example.com";
    objEmailAdapter.Subject = "Status Report";
    objEmailAdapter.Submit();

The EmailAdapter object contains the following properties:

Property | Description
--- | ---
AttachmentFileName | Returns or sets the file name to be used for the current form when attached to the e-mail message for an EmailAdapter object.
BCC | Returns or sets the BCC recipients for an EmailAdapter object.
CC | Returns or sets the CC recipients for an EmailAdapter object.
Intro | Returns or sets the introduction in the body of the e-mail message for an EmailAdapter object.
Name | Returns the name of an EmailAdapter object.
QueryAllowed | Corresponds to the queryAllowed attribute in the form definition file (.xsf). Always returns False for the EmailAdapter object.
Subject | Returns or sets the subject of the e-mail message for the specified EmailAdapter object.
SubmitAllowed | Corresponds to the submitAllowed attribute in the form definition file (.xsf). Always returns True for the EmailAdapter object.
To | Returns or sets the To recipients for the specified EmailAdapter object.

The EmailAdapter object contains the following methods:

Method | Description
--- | ---
Query | Because the EmailAdapter object is available for submitting data only, this method will always generate a run-time error when it is called on that object.
Submit | Executes the submit operation on the associated data adapter.
SubmitData | Submits the specified DOM element or DOM document to a data adapter.

©2003-2004 Microsoft Corporation. All rights reserved. Permission to copy, display and distribute this document is available at: http://msdn.microsoft.com/library/en-us/odcXMLRef/html/odcXMLRefLegalNotice.asp