The FormData property defines the form. It specifies the name of the form and lists all the fields in the form.
This property is only meaningful if ContentType is set to MSMQMAIL_EMAIL_FORM.
Type: | MSMQMailFormData |
Run time: | Read-write |
object.FormData
Syntax Element | Description |
---|---|
object | E-mail message (MSMQMailEMail) object that defines the e-mail message. |
MSMQMailFormData object.
When defining an e-mail object that represent a form, set ContentType to MSMQMAIL_EMAIL_FORM whenever FormData is set.
After parsing an MSMQ mail message, verify that ContentType is set to MSMQMAIL_EMAIL_FORM, before looking at FormData. This property is empty if ContentType indicates another e-mail type.
This example defines an e-mail form with three fields, composes the body of an MSMQ mail message, and displays a name of the form plus the number of fields in the form.
To try this example using Microsoft Visual Basic (version 5.0), paste the code into the Code window of a form, run the example, and click the form.
Option Explicit
Dim email As New MSMQMailEMail
Dim msg As New MSMQMessage
Private Sub Form_Click()
'*********************
'* Define e-mail
'*********************
'Set e-mail type as form.
email.ContentType = MSMQMAIL_EMAIL_FORM
'Set who receives the e-mail.
email.Recipients.Add "RecipientName", "RecipientQueueLabel", MSMQMAIL_RECIPIENT_TO
'Set who sent the e-mail.
email.Sender.Name = "Our name"
email.Sender.Address = "Our queue label"
'Set the subject of the e-mail.
email.Subject = "Test mail."
'**********************
'* Define the form.
'**********************
'Set the form name.
email.FormData.Name = "Test Form"
'Set fields of form
email.FormData.FormFields.Add "Field1", "Field1 text."
email.FormData.FormFields.Add "Field2", True
email.FormData.FormFields.Add "Field3", Date
'******************************
'Compose the mail message Body.
'******************************
msg.Body = email.ComposeBody
MsgBox "Defined the form " + email.FormData.Name + " with " + CStr(email.FormData.FormFields.Count) + " fields."
End Sub
Windows NT: Requires version 4.0 SP3 or later.
Windows: Requires Windows 95 or later.
Windows CE: Unsupported.
Import Library: Included as a resource in mqmailoa.dll.
Unicode: Defined only as Unicode.
Add, Address, ComposeBody, ContentType, FormFields, MSMQMailEMail, MSMQMessage, Name, Recipients, Sender, Subject