The Item property provides read access to the recipients of an e-mail's recipient list (MSMQMailRecipientList) or the fields of a form's field list (MSMQMailFormFieldList).
Type: | MSMQMailRecipient or MSMQMailFormField object |
Run time: | Read-only |
set object3=object1.Object2.Item (IndexKey)
Syntax Element | Description |
---|---|
object1 | E-mail message (MSMQMailEMail) object that defines the e-mail message. |
object2 | Recipient list (MSMQMailRecipientList) object. |
object3 | Recipient (MSMQMailRecipient) object. |
IndexKey | Specifies the position in the recipient list or a specific recipient's key. Numeric indexes range from 1 to Count. Keys are added when the recipient is added to the list. |
set object4=object1.Object2.Object3.Item (IndexKey)
Syntax Element | Description |
---|---|
object1 | E-mail message (MSMQMailEMail) object that defines the e-mail message. |
object2 | Form data (MSMQMailFormData) object that defines the form. |
object3 | Form field list (MSMQMailFormFieldList) object that references the field. |
object4 | Form field (MSMQMailFormField) object that defines the field. |
IndexKey | Specifies the position in the field list or a specific field's key. Numeric indexes range from 1 to Count. Keys are added when the recipient is added to the list. |
MSMQMailRecipient or MSMQMailFormField object.
Item is the default property for the MSMQMailRecipientList and MSMQMailFormFieldList objects. Thus, RecipientList[2] and RecipientList.Item[2] both return the second recipient in the recipient list.
This example adds three recipients and displays the address of the MAPI recipient using a recipient key.
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.
Dim email As New MSMQMailEMail
Dim recipient As New MSMQMailRecipient
Private Sub Form_Click()
'****************
'* Define eimail
'****************
'Set e-mail type to text message
email.ContentType = MSMQMAIL_EMAIL_TEXTMESSAGE
'Add Recipients.
email.Recipients.Add "Exchange_User", "ExchangeUser@ServerInputQueueLabel", MSMQMAIL_RECIPIENT_TO
email.Recipients.Add "MAPI_User", "MAPIUserInputQueueLabel", MSMQMAIL_RECIPIENT_CC, "MAPI"
email.Recipients.Add "Exchange_User", "ExchangeUser@ServerInputQueueLabel", MSMQMAIL_RECIPIENT_BCC
'Set who is sending 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."
'Set the Body of the e-mail.
email.TextMessageData.Text = "This is the Body of the message."
'*********************************
'* Display Name of MAPI recipient.
'*********************************
Set recipient = email.Recipients.Item("MAPI")
MsgBox "The MAPI recipient's address is: " + recipient.Address
End Sub
This example defines a form with three fields and displays the name of the second field using the field key specified when the field was added.
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.
Dim email As New MSMQMailEMail
Dim msg As New MSMQMessage
Dim field As New MSMQMailFormField
Private Sub Form_Click()
'*********************
'* Define e-mail
'*********************
'Set e-mail type to form message.
email.ContentType = MSMQMAIL_EMAIL_FORM
'Add primary recipient.
email.Recipients.Add "Exchange_User", "ExchangeUser@ServerInputQueueLabel", MSMQMAIL_RECIPIENT_TO
'Set who sent the e-mail.
email.Sender.Name = "Our name"
email.Sender.Address = "Our queue label"
'Set subject of mail.
email.Subject = "Test form."
'Set form name.
email.FormData.Name = "Test Form"
'Set form field list.
email.FormData.FormFields.Add "Name", "Test Field"
email.FormData.FormFields.Add "Employed", True, "Employed"
email.FormData.FormFields.Add "CurrentDate", "DateString"
'***********************
'* Compose message Body.
'***********************
msg.Body = email.ComposeBody
'*******************************************
'* Display the value of the "Employed field.
'*******************************************
Set field = email.FormData.FormFields.Item("Employed")
MsgBox "The value of the Employment field is: " + CStr(field.Value)
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, ContentType, FormData, FormFields, MSMQMailEMail, MSMQMailFormData, MSMQMailRecipient, MSMQMessage, Name, Recipients, Sender, Subject, Text, TextMessageData