RDOMail object

 

RDOMail object represents a MAPI message.

 

Note that many other RDO objects representing specific Outlook items (contacts, tasks, appointments, etc) are derived from RDOMail: RDOAppointmentItem, RDOContactItem, RDODistListItem, RDOJournalItem, RDOMeetingItem, RDONoteItem, RDOPostItem, RDOReportItem, RDOTaskItem, RDOTaskRequestItem .

These objects (since they are derived from RDOMail) inherit all of its properties and methods.

 

Returned by:

RDOSession.GetMessageFromID

RDOStore.GetMessageFromID

RDOItems.Add, GetFirst, GetLast, GetNext, GetPrevious, Item

RDODeletedItems.Restore

RDOAttachment.Parent, EmbeddedMsg

RDOMail.Move, Reply, ReplyAll, Forward

 

 

The example below logs to the default MAPI session and prints out the subject and sender name of each message in the Inbox folder.

set Session = CreateObject("Redemption.RDOSession")
Session.Logon
set Folder = Session.GetDefaultFolder(olFolderInbox)
set Items = Folder.Items
for i = 1 to Items.Count
  set Mail = Items.Item(i)
  Debug.Print Mail.Subject & " - from: " & Mail.SenderName
next

 

Properties

Methods

Events

 


Derived from: _MAPIProp -


_MAPIProp methods and properties: GetIDsFromNames, Fields(), GetPropList, GetNamesFromIDs, CopyTo, Save, MAPIOBJECT, Session

 

CopyTo(DestObj)

Copies the message to the destination object. RDOMail overrides the behavior inherited from _MAPIProp depending on the type of the DestObj parameter, which can be either another message represented by the RDOMail object or a folder represented by the RDOFolder object

set Session = CreateObject("Redemption.RDOSession")
Session.Logon
set Inbox = Session.GetDefaultFolder(olFolderInbox)
set Drafts = Session.GetDefaultFolder(olFolderDrafts)

'grab a message with a given subject
set Msg = Inbox.Items("test message")

'copy to the Drafts folder
Msg.CopyTo(Drafts)
'or create a new message in Drafts, then copy
set NewMsg = Drafts.Items.Add("IPM.Note")
Msg.CopyTo(NewMsg)

NewMsg.Save

 

MarkRead(SuppressReceipt )

Marks the message as read. If SuppressReceipt is TRUE, no read receipt is generated (if one is requested). If SuppressReceipt is FALSE, the behavior is analogous to setting the the UnreadPropety to false - message will be marked as read and a read receipt will be generated if it is requested.

 

 

 


Properties


Account

Returns or sets the RDOAccount object that either was used to receive the message or to be used to send it.

Read/write

set Session = CreateObject("Redemption.RDOSession")
Session.Logon
set Drafts = Session.GetDefaultFolder(olFolderDrafts)
set Msg = Drafts.Items.Add
set Account = Session.Accounts("My ISP account")
Msg.Account = Account
Msg.To = "user@domain.com"
Msg.Recipients.ResolveAll
Msg.Subject = "test"
Msg.Body = "Test body"
Msg.Save
Msg.Send

 

Actions

Returns RDOActions collection that represents all the specialized actions that can be executed on a message.

 

et Session = CreateObject("Redemption.RDOSession")
Session.Logon
set Mail = Session.GetDefaultFolder(olFolderOutbox).Items.Add("IPM.Note")
Mail.Subject = "test Redemption action"
Mail.Body = "test body"
Mail.Recipients.Add "user@domain.com"
set action = Mail.Actions.Add
action.name = "Test respond"
action.copylike = olRespond
action.enabled = true
action.messageclass = "IPM.Note"                  
'the message class to be used when the action is invoked
action.prefix = "TEST"                                        'Subject prefix
action.ReplyStyle = olEmbedOriginalItem '       'original message will be embedded
action.ResponseStyle = olPrompt '2                    'prompt when the action is invoked
action.ShowOn = 2 'olMenuAndToolbar             'show the action on both the popup menu and the Inspector toolbar
Mail.Send

 

AlternateRecipientAllowed

True if the mail message can be forwarded. Read/write Boolean.

 

 

Attachments

Returns an RDOAttachments object that represents all the attachments for the specified item. Read-only

for each att in Mail.Attachments
  debug.print att.filename
next

 

AutoForwarded

True if the mail message was automatically forwarded. Read/write Boolean.

 

 

BCC

Returns a String representing the display list of blind carbon copy (BCC) names for a message. This property contains the display names only. The Recipients collection should be used to modify the BCC recipients. Read/write.

 

 

BillingInformation

Returns or sets a String representing the billing information associated with the message. This is a free-form text field. Read/write.

 

 

Body

Returns or sets a String representing the clear-text body of the message. Read/write.

 

 

BodyFormat

Returns or sets an OlBodyFormat constant indicating the format of the body text. The body text format determines the standard used to display the text of the message. Microsoft Outlook provides three body text format options: Plain Text, Rich Text (RTF), and HTML. Read/write.

 

Categories

Returns or sets a String representing the categories assigned to the message. Read/write.

 

 

CC

Returns a String representing the display list of carbon copy (CC) names for a message. This property contains the display names only. The Recipients collection should be used to modify the CC recipients. Read/write.

 

 

Companies

Returns or sets a String representing the names of the companies associated with the message. This is a free-form text field. Read/write.

 

 

Conflicts

Returns RDOConflicts, read-only. Represents the items that are in conflict with the given message.

 

 

ConversationIndex

Returns a hex String representing the binary index of the conversation thread of the message. Read-write.

 

 

ConversationTopic

Returns a String representing the topic of the conversation thread of the message. Read-write. This is typically a Subject with the prefix (RE, FW, etc) removed.

 

 

CreationTime

Returns a Date indicating the creation time for the message. This property corresponds to the MAPI property PR_CREATION_TIME. Read-only.

 

 

DeferredDeliveryTime

Returns or sets a Date indicating the date and time the mail message is to be delivered. This property corresponds to the MAPI property PR_DEFERRED_DELIVERY_TIME. Read/write

 

DeleteAfterSubmit

True if a copy of the mail message is not saved upon being sent. False if a copy is saved. Read/write Boolean.

 

 

DownloadPictures

Returns or sets a Boolean indicating whether the pictures referenced by the HTML body will be downloaded and displayed by Outlook.

 

set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set Msg = Session.GetMessagefromID(Application.ActiveExplorer.Selection(1).EntryID)
Msg.DownloadPictures = true
Msg.Save

 

EntryID

Returns a hex String representing the unique entry ID of the object. This property corresponds to the MAPI property PR_ENTRYID. Read-only.

 

 

ExpiryTime

Returns or sets a Date indicating the date and time at which the item becomes invalid and can be deleted. Read/write.

 

 

FlagDueBy

Returns or sets a Date specifying the date by which an e-mail message is due. This property is only valid if the FlagStatus property is also set for the message. This property corresponds to the MAPI property PR_REPLY_TIME. Read/write.

 

 

FlagIcon

Returns or sets an olFlagIcon constant indicating one or none of the six flag types in Microsoft Office Outlook 2003 for e-mail messages. Read/write.

 

FlagRequest

Returns or sets a String indicating the requested action for an e-mail message. This is a free-form text field. This property is only valid if the FlagStatus property is also set for the message. Read/write.

 

 

FlagStatus

Returns or sets an OlFlagStatus constant indicating the flag status for an e-mail message. Read/write.

 

HidePaperClip

True if Outlook must hide the paperclip icon even if the message has attachments. False otherwise. Read/write Boolean.

 

 

HTMLBody

Returns or sets a String representing the HTML body of the specified item. The HTMLBody property should be an HTML syntax string. Read/write.

 

 

Importance

Returns or sets an OlImportance constant indicating the relative importance level for the message. This property corresponds to the MAPI property PR_IMPORTANCE. Read/write.

 

 

InternetCodepage

Returns or sets a Long that determines the Internet code page used by the item. The Internet code page defines the text encoding scheme used by the item. Read/write. Corresponds to the PR_INTERNET_CPID MAPI property.

 

 

LastModificationTime

Returns a Date specifying the date and time that the message was last modified. This property corresponds to the MAPI property PR_LAST_MODIFICATION_TIME. Read-only.

 

Links

Returns an RDOLinks collection of RDOLink objects that represent the contacts to which the item is linked.

 

'Add a contact with a given name to an item
set ContactToAdd = Session.GetDefaultFolder(olFolderContacts).Items("John Smith")
ThisMessage.Links.Add(ContactToAdd)
ThisMessage.Save

 

MessageClass

Returns or sets a String representing the message class for the Microsoft Outlook item or Action. This property corresponds to the MAPI property PR_MESSAGE_CLASS. Read-write.

 

 

Mileage

Returns or sets a String representing the mileage for an item. This is a free-form string field and can be used to store mileage information associated with the item (for example, 100 miles documented for an appointment, contact, or task) for purposes of reimbursement. Read/write.

 

 

Modified

Boolean, read-only. Returns true if the message had been modified and has not been saved yet.

 

 

NoAging

True to not age the message. Read/write Boolean.

 

 

OriginatorDeliveryReportRequested

Returns or sets a Boolean value that determines whether the originator of the meeting item or mail message will receive a delivery report. Each transport provider that handles your message sends you a single delivery notification containing the names and addresses of each recipient to whom it was delivered. Note that delivery does not imply that the message has been read. The OriginatorDeliveryReportRequested property corresponds to the MAPI property PR_ORIGINATOR_DELIVERY_REPORT_REQUESTED. True if the originator requested a delivery receipt on the message. Read/write.

 

 

OutlookInternalVersion

Returns a Long representing the build number of the Microsoft Outlook application for an Outlook item. Read-only.

 

 

OutlookVersion

Returns a String indicating the major and minor version number of the Microsoft Outlook application for an Outlook item. Read-only.

 

 

Parent

Message parent. Returns RDOFolder for the messages that exist in a folder, RDOMail for the embedded message attachments. Read-only.

 

 

ReadReceiptRequested

True if a read receipt has been requested by the sender. This property corresponds to the MAPI property PR_READ_RECEIPT_REQUESTED. Read/write.

 

 

ReceivedByEntryID

Returns a hex String representing the EntryID for the true recipient as set by the transport provider delivering the mail message. This property corresponds to the MAPI property PR_RECEIVED_BY_ENTRYID. Read-write.

 

 

ReceivedByName

Returns a String representing the display name of the true recipient for the mail message. This property corresponds to the MAPI property PR_RECEIVED_BY_NAME. Read-write.

 

 

ReceivedOnBehalfOfEntryID

Returns a hex String representing the EntryID of the user delegated to represent the recipient for the mail message. This property corresponds to the MAPI property PR_RCVD_REPRESENTING_ENTRYID. Read-write.

 

 

ReceivedOnBehalfOfName

Returns a String representing the display name of the user delegated to represent the recipient for the mail message. This property corresponds to the MAPI property PR_RCVD_REPRESENTING_NAME. Read-write.

 

 

ReceivedTime

Returns or sets a Date indicating the date and time at which the mail message, meeting item, or post was received. Read-write.

 

 

RecipientReassignmentProhibited

True if the recipient cannot forward the mail message. Read/write Boolean

 

 

Recipients

Returns an RDORecipients collection that represents all the recipients for the message. Read-write.

 

This object property can be set to either Recipients/ReplyRecipients collection of another message or a Recipients collection returned by the RDOAddressBook.ShowAddressBook method

 

'enumerate all recipients

for each Recip in Mail.Recipients
  Debug.Print Recip.Name
next

 

'example #2 - set the recipients to the Recipients

'collection returned by the ShowAddressBook method

set AB = Session.AddressBook

set Recips = AB.ShowAddressBook(Mail.Recipients)
Mail.Recipients = Recips

 

ReminderOverrideDefault

True if the reminder overrides the default reminder behavior for the appointment, mail item, or task. Read/write Boolean

 

 

ReminderPlaySound

True if the reminder should play a sound when it occurs for this appointment or task. The ReminderPlaySound property must be set in order to validate the ReminderSoundFile property. Read/write Bool

 

 

ReminderSet

True if a reminder has been set for this appointment, e-mail item, or task. Read/write Boolean

 

 

ReminderSoundFile

Returns or sets a String indicating the path and file name of the sound file to play when the reminder occurs for the

 appointment, mail message, or task. This property is only valid if the ReminderOverrideDefault and ReminderPlaySound properties are set to True. Read/write.

 

 

ReminderTime

Returns or sets a Date indicating the date and time at which the reminder should occur for the specified message. Read/write.

 

 

ReplyRecipientNames

Returns a semicolon-delimited String list of reply recipients for the mail message. This property only contains the display names for the reply recipients. The reply recipients list should be set by using the ReplyRecipients collection. Read-only.

 

 

ReplyRecipients

Returns or sets an RDORecipients collection that represents all the reply recipient objects for the mail message.

 

set AB = Session.AddressBook

Mail.ReplyRecipients = AB.ShowAddressBook(Mail.ReplyRecipients, "Reply recipients")

RTFBody

Returns or sets a String representing the RTF body of the specified item. The RTFBody property should be an RTF syntax string. Read/write.

 

 

SaveSentMessageFolder

Returns an RDOFolder object that represents the folder in which a copy of the e-mail message will be saved after being sent. Read-write.

 

 

Sender

Returns or sets an RDOAddressEntry object representing the message sender.

Read/write.

 

 

SenderEmailAddress

Returns or sets a String that represents the e-mail address of the sender of the e-mail message, meeting item, or post. This property corresponds to the MAPI property PR_SENDER_EMAIL_ADDRESS. Read-write.

 

 

SenderEmailType

Returns or sets a String that represents the type of entry for the e-mail address of the sender of the message, meeting item, or post, such as 'SMTP' for Internet address, 'EX' for a Microsoft Exchange server address, etc. Read-write.

 

 

SenderName

Returns or sets a String indicating the display name of the sender for the e-mail message, meeting item, or post. This property corresponds to the MAPI property PR_SENDER_NAME. Read-write

 

 

SenderEntryID

Returns or sets a hex String indicating the entry of the sender for the e-mail message, meeting item, or post. This property corresponds to the MAPI property PR_SENDER_ENTRYID. Read-write

 

 

Sensitivity

Returns or sets an OlSensitivity constant indicating the sensitivity for the Microsoft Outlook item. This property corresponds to the MAPI property PR_SENSITIVITY. Read/write.

 

Sent

Returns or sets a Boolean value that indicates if a message has been sent. True if sent, False if not sent. Read-write. Corresponds to the MSGFLAG_UNSENT bit in the PR_MESSAGE_FLAGS MAPI property.

.Note that most MAPI providers allow to set this property before the message is saved for the very first time.

 

 

SentOn

Returns or sets a Date indicating the date and time on which the mail message, meeting item, or post was sent. This property corresponds to the MAPI property PR_CLIENT_SUBMIT_TIME. Read-write.

 

 

SentOnBehalfOf

Returns or sets an RDOAddressEntry object representing the  intended sender of the message.

Read/write.

 

 

SentOnBehalfOfName

Returns or sets a String indicating the display name for the intended sender of the mail message. This property corresponds to the MAPI property PR_SENT_REPRESENTING_NAME. Read/write.

 

 

SentOnBehalfOfEmailAddress

Returns or sets a String indicating the e-mail address for the intended sender of the mail message. This property corresponds to the MAPI property PR_SENT_REPRESENTING_EMAIL_ADDRESS. Read/write.

 

 

SentOnBehalfOfEmailType

Returns or sets a String indicating the e-mail address type for the intended sender of the mail message. This property corresponds to the MAPI property PR_SENT_REPRESENTING_ADDRTYPE. Read/write.

 

 

SentOnBehalfOfEntryID

Returns or sets a hex String indicating the entry id for the intended sender of the mail message. This property corresponds to the MAPI property PR_SENT_REPRESENTING_ENTRYID. Read/write.

 

 

Size

Returns a Long indicating the size (in bytes) of the message. Read-only.

 

 

Store

Returns an RDOStore object representing the parent store of the message. Read-only.

 

 

Subject

Returns or sets a String indicating the subject for the message. This property corresponds to the MAPI property PR_SUBJECT. Read/write.

 

set Session = CreateObject("Redemption.RDOSession")
Session.Logon
set Inbox = Session.GetDefaultFolder(olFolderInbox)
for each Msg in Inbox.Items
  Debug.Print(Msg.Subject)
next

 

Submitted

Returns a Boolean value that indicates if the item has been submitted. True if the item has been submitted. Read-only.

 

 

To

Returns or sets a semicolon-delimited String list of display names for the To recipients for the message. This property contains the display names only. The Recipients collection should be used to modify the TO recipients. Read/write.

 

 

UnRead

True if the message has not been opened (read). Read/write Boolean.

 

 

UserProperties

RDOUserProperties, read-only.

 

RDOUserProperties collection contains custom properties of an Outlook item. Note that this collection is compatible with the UserProperties collection in the Outlook Object Model (see MSDN), but also exposes properties not exposed through the Outlook Object Model, such as RDOUserProperty.Printable / Required.

 

On the MAPI level user property values are stored as regular named MAPI properties, but Outlook also stores the properties definitions in a special binary blob, which in turn is stored in another named MAPI property on the item.

You can access the values of the user properties using MAPIProp.Fields, but RDOUserProperties collection allows to modify the user properties definitions, which are also used when designing a form or when managing folder fields (see RDOFolderFields).

 

set Session = CreateObject("Redemption.RDOSession")
Session.Logon
Set task = Session.GetDefaultFolder(olFolderTasks).Items.add
task.TotalWork = 3000
task.Subject = "Test task with a user property"
Set Prop = task.UserProperties.Add("TotalWork", olFormula)
Prop.Formula = "[Total Work]"
Prop.ValidationFormula = ">= 2400"
Prop.ValidationText = "Total work must be greater than 2400"
task.Save

VotingOptions

Returns or sets a String specifying a delimited string containing the voting options for the mail message. Read/write.

set Session = CreateObject("Redemption.RDOSession")
Session.Logon

set Mail = Session.GetDefaultFolder(olFolderOutbox).Items.Add("IPM.Note")
Mail.Recipients.Add "eaters@lunch.com"
Mail.Subject = "Lunch anybody?"
Mail.Body = "Please open the message and click on one of the buttons" & vbCrLf & _

                    " (Chinese;Italian;Mexican;Don't care) on the toolbar" & vbCrLf & _

                   ''to indicate your lunch preference"
Mail.VotingOptions = "Chinese;Italian;Mexican;Don't care"
Mail.Send

 

VotingResponse

Returns or sets a String specifying the voting response for the mail message. Read/write.

 

 


Methods


GetProps(Tags)
Retrieves multiple properties in a single call.

Tags - Variant. can be either:
integer - assumed to be a property tag
string - assumed to be a DASL property name or a ";" separated list of DASL property names
array - each element is either an integer (prop tag) or a string (property name in the DASL format).

Returns a variant array of variants with the values of the requested properties.
set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set Msg = Session.GetMessageFromID(Application.ActiveExplorer.Selection(1).EntryID)
Dim Tags(2)
'Subject
Tags(0) = "http://schemas.microsoft.com/mapi/proptag/0x0037001F"
'Sender name
Tags(1) = "http://schemas.microsoft.com/mapi/proptag/0x0C1A001F"
'Sender e-mail address
Tags(2) = "http://schemas.microsoft.com/mapi/proptag/0x0C1F001F"
Values = Msg.GetProps(Tags)
Debug.Print "Subject: " + Values(0)
Debug.Print "Sender Name: " + Values(1)
Debug.Print "Sender Address: " + Values(2)

Send

Sends the message

 

 

Import(Path, Type)

Imports the contents of an external file into the message.

Path - string. Fully qualified path to the file to be imported.

Type - optional. One of following values. If the file type is not specified, the MSG format (.msg) is used.

olRFC822 (1024)

olTNEF (1025)

olMsg (3)

olRtf (1)

 

 

SaveAs(Path, Type)

Saves the message to the specified path and in the format of the specified file type.

Path - string. Fully qualified path.

Type - optional. One of following values. If the file type is not specified, the MSG format (.msg) is used.

 

Supported formats:

olMSG (3)

olMsgUnicode (9)

olRTF (1)

olTemplate (2)

olTxt (0)

olVCard (6)

olRFC822 (1024)

olTNEF (1025)

olHTML (5)

olRTFNoHeaders (1026)

olMHTML (1027)

olVCal (7)

olICal (8)

 

 

Design(ParentWnd)

Open the message in the design mode. The same as designing the message using "Tools | Forms | Design This Form" menu in Outlook.

ParentWnd - integer, optional. The window handle (HWND) of the window to be used as the parent of the form. If not specified, the window handle of the foreground window is used.

 

 

Display(Modal, ParentWnd)

Displays the message using the MAPI form associated with the given message based on its message class.

Modal - boolean, optional. If true, the form is displayed modally.

ParentWnd - integer, optional. The window handle (HWND) of the window to be used as the parent of the form. If not specified, the window handle of the foreground window is used.

 

 

PrintOut(ParentWnd)

Prints the message using the MAPI form associated with the given message based on its message class.

ParentWnd - integer, optional. The window handle (HWND) of the window to be used as the parent of the form. If not specified, the window handle of the foreground window is used.

 

Delete(DeleteFlags)

Deletes a message.

DeleteFlags - integer, optional. One of the redDeleteFlags enumeration values:

dfSoftDelete (0) - default. Deletes the item. Can still be recoverable if retention policy is set on Exchange Server.

dfMoveToDeletedItems (1) - the item is moved to the Deleted Items folder

dfHardDelete (2) - Exchange only. Permanently deletes the item; will not be recoverable

 

set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set Mail = Session.GetMessageFromID(MailItem.EntryID)
Mail.Delete(dfSoftDelete)

MarkRead(SuppressReceipt)

Marks the message as read.

 

SuppressReceipt - boolean. If true, the read receipt (if requested) will not be sent. If false, pending read receipts (if requested) will be sent.

 

 

Move(DestFolder)

Moves message to a new folder.

DestFolder - The destination folder (RDOFolder object).

Returns the new message (RDOMail object) in the destination folder.

 

 

Reply

Creates a reply, pre-addressed to the original sender, from the original message. Returns the reply as an RDOMail object.

 

 

ReplyAll

Creates a reply to all original recipients from the original message. Returns the reply as a RDOMail object.

 

 

Forward

Creates a forward from the original message (no recipients). Returns the forwarded message as a RDOMail object.

 

 

AbortSubmit

Aborts the submission of the message. If the message is not currently in the spooler queue, an error is returned.

 

 

DoAction(Action, ParentWnd)

Perform a specified action on the message using its associated form. This method corresponds to IMAPIForm::DoVerb() in Extended MAPI. This method loosely corresponds to the Action.Execute method in the Outlook Object Model (Action object can be retrieved from the MailItem.Actions collection in OOM).

 

Action - one of the rdoMessageAction constants. Corresponds to the EXCHIVERB_xxx constants in Extended MAPI. Available values:

maOpen (0) - displays the message in an associated form
maReply (101) - displays a reply in an associated form
maReplyAll (103) - displays a "reply to all" meessage in an associated form
maForward (104) displays the forwarded message in an associated form
maPrint (105) - prints the message
maSaveAs (106) - displays the "Save As" dialog box
maReplyToFolder (108) - creates and displays a "Reply to Folder" message.

maDesignForm (534) - open the message in the design mode. The same as designing the message using "Tools | Forms | Design This Form" menu in Outlook.

 

ParentWnd - integer, optional. The window handle (HWND) of the window to be used as the parent of the form. If not specified, the window handle of the foreground window is used.

 


Events:


OnModified

Fires when a modified message is saved

Dim WithEvents Mail As Redemption.RDOMail
...

Set Session = New Redemption.RDOSession
Session.Logon
Set Store = Session.Stores.DefaultStore
Set Inbox = Store.GetDefaultFolder(olFolderInbox)
Set Mail = Inbox.Items("Test Subject") 'retrieve a message with the subject "Test Subject" from the Inbox
...

Sub Mail_OnModified()
  MsgBox "Message modified!"
End Sub

OnDeleted

Fires when the message is deleted

 

 

OnMoved

Fires when the message is moved to a different folder

 

 

OnMovedEx(OldParentEntryID, NewParentEntryID)

Fires when the message is moved to a different folder.

OldParentEntryID - string, entry id (in hex) of the old parent folder.

NewParentEntryID - string, entry id (in hex) of the new parent folder.

 

 

OnClose

Fires when the message displayed in an inspector (MAPI form) is closed.