ref: vbMAPI_MailItem

On this page you'll find:

Overview

Equivalent MAPI object: IMessage
Equivalent Outlook Redemption object: Redemption.SafeMailItem
Equivalent Outlook Object Model object: Outlook.MailItem
Parent: vbMAPI_FolderItems

Class Description

This object is a wrapper for the MAPI IMessage object. To create a new object of type vbMAPI_MailItem, use the vbMAPI_FolderItems Add method. To open an existing object, use the vbMAPI_FolderItems Item method.


Property Get Properties() As vbMAPI_Properties

Exposes a collection of the MAPI properties set on this message.  The default member of the vbMAPI_Properties class is Item, therefore in VB you can call vbMAPI_MailItem.Properties(PropTag) directly.

Property Get NamedProperties(ByVal PropertySetGUID As String, _
              ByVal ID As Variant, _
              ByVal DataType As EnumMAPIPropDataTypes) As vbMAPI_Property

Provides access to MAPI named properties for this MailItem.

PropertySetGUID: A string representation of the property set GUID (e.g. )
ID: The name (string) or property identifier (integer) representing the property to query from the property set.
DataType: The MAPI data type of the property.

Property Get Recipients() As vbMAPI_Recipients

Property Let Recipients(ByVal InRecipients As vbMAPI_Recipients)

Provides a collection of recipient objects associated with this message.

You can copy whole collections between objects by assigning the Recipients property to another vbMAPI_Recipients collection.

Property Get Attachments() As vbMAPI_Attachments

Provides a collection of attachment objects.

Sub Save()

Saves any modifications made to the current message.

Sub Send()

Submits the message to the message store for sending.  Implicit saving of recipients, attachments and the message itself occurs before sending.

Property Get RTFBody() As vbMAPI_EncodedBody

Returns/sets the RTF version of the body for this message.  Can be derived from HTML/PlainText if not supported by the message store, or if explicitly requested using the Source parameter.

The default member of the vbMAPI_EncodedBody class is the Value property, therefore you can ignore the vbMAPI_EncodedBody class and treat this property as a string.

Property Get HTMLBody() As vbMAPI_EncodedBody

Returns/sets the HTML version of the body for this message.  Can be derived from RTF/PlainText if not supported by the message store, or if explicitly requested using the Source parameter.

The default member of the vbMAPI_EncodedBody class is the Value property, therefore you can ignore the vbMAPI_EncodedBody class and treat this property as a string.

Property Get Body() As vbMAPI_EncodedBody

Returns/sets the plain text version of the body for this message.  Can be derived from HTML/RTF if not supported by the message store, or if explicitly requested using the Source parameter.

The default member of the vbMAPI_EncodedBody class is the Value property, therefore you can ignore the vbMAPI_EncodedBody class and treat this property as a string.

Property Get BodyFormat() As EnumEncodedBodyFormat

Returns the type of body format that is stored in this message. (BodyFormat_PlainText / BodyFormat_HTML / BodyFormat_RTF).

Property Get SendAccount() As vbMAPI_Account

Returns the Outlook account associated with this message (Outlook 2003+).

Property Get SendAccountStamp() As String

Property Let SendAccountStamp(ByVal Value As String)

Returns/sets the Outlook account (by vbMAPI_Account::SendStamp) that will be used for sending the message (Outlook 2003+).

Property Get SendAccountName() As String

Property Let SendAccountName(ByVal AccountName As String)

Returns/sets the Outlook account (by vbMAPI_Account::Name) that will be used for sending the message (Outlook 2003+).

Property Get To() As String

Property Let To(ByVal StringList As String)

Returns/sets a delimited list of recipients on this item (type MAPI_TO).

Property Get CC() As String

Property Let CC(ByVal StringList As String)

Returns/sets a delimited list of recipients on this item (type MAPI_CC).

Property Get BCC() As String

Property Let BCC(ByVal StringList As String)

Returns/sets a delimited list of recipients on this item (type MAPI_BCC).

Property Get SaveSentMessageFolderEntryID() As String

Property Let SaveSentMessageFolderEntryID(ByVal RetVal As String)

Returns/sets the EntryID of the vbMAPI_Folder where the message will be moved to once it has been sent.

Property Get InternetMessageHeaders() As String

Returns the value of the MAPI property PR_TRANSPORT_MESSAGE_HEADERS from this message.

Property Get AlternateRecipientAllowed() As Boolean

Property Let AlternateRecipientAllowed(ByVal RetVal As Boolean)

Returns/sets the value of the MAPI property PR_ALTERNATE_RECIPIENT_ALLOWED from this message.

Property Get AutoForwarded() As Boolean

Property Let AutoForwarded(ByVal RetVal As Boolean)

Returns/sets the value of the MAPI property PR_AUTO_FORWARDED from this message.

Property Get ConversationIndex() As Variant

Property Let ConversationIndex(ByVal RetVal As Variant)

Returns/sets the value of the MAPI property PR_CONVERSATION_INDEX from this message.

Property Get ConversationTopic() As String

Property Let ConversationTopic(ByVal RetVal As String)

Returns/sets the value of the MAPI property PR_CONVERSATION_TOPIC from this message.

Property Get CreationTime() As Date

Returns the value of the MAPI property PR_CREATION_TIME from this message.

Property Get DeferredDeliveryTime() As Date

Returns the value of the MAPI property PR_DEFERRED_DELIVERY_TIME from this message.

Property Get DeleteAfterSubmit() As Boolean

Property Let DeleteAfterSubmit(ByVal RetVal As Boolean)

Returns/sets the value of the MAPI property PR_DELETE_AFTER_SUBMIT from this message.

Property Get EntryID() As String

Returns the value of the MAPI property PR_ENTRYID from this message.

Property Get ExpiryTime() As Date

Property Let ExpiryTime(ByVal RetVal As Date)

Returns/sets the value of the MAPI property PR_EXPIRY_TIME from this message.

Property Get FlagIcon() As EnumFlagIcon

Property Let FlagIcon(ByVal RetVal As EnumFlagIcon)

Returns/sets the value of the MAPI property PR_FLAG_ICON from this message.

Property Get Importance() As EnumImportance

Property Let Importance(ByVal RetVal As EnumImportance)

Returns/sets the value of the MAPI property PR_IMPORTANCE from this message.

Property Get FlagStatus() As EnumFlagStatus

Property Let FlagStatus(ByVal RetVal As EnumFlagStatus)

Returns/sets the value of the MAPI property PR_FLAG_STATUS from this message.

Property Get InternetCodepage() As Long

Property Let InternetCodepage(ByVal RetVal As Long)

Returns/sets the value of the MAPI property PR_INTERNET_CPID from this message.

Property Get LastModificationTime() As Date

Returns the value of the MAPI property PR_LAST_MODIFICATION_TIME from this message.

Property Get MessageClass() As String

Property Let MessageClass(ByVal RetVal As String)

Returns/sets the value of the MAPI property PR_MESSAGE_CLASS from this message.

Property Get OriginatorDeliveryReportRequested() As Boolean

Property Let OriginatorDeliveryReportRequested(ByVal RetVal As Boolean)

Returns/sets the value of the MAPI property PR_ORIGINATOR_DELIVERY_REPORT_REQUESTED from this message.

Property Get ParentEntryID() As String

Returns the value of the MAPI property PR_PARENT_ENTRYID from this message.

Property Get StoreEntryID() As String

Returns the value of the MAPI property PR_STORE_ENTRYID from this message.

Property Get ReadReceiptRequested() As Boolean

Property Let ReadReceiptRequested(ByVal RetVal As Boolean)

Returns/sets the value of the MAPI property PR_READ_RECEIPT_REQUESTED from this message.

Property Get ReceivedByEntryID() As String

Returns the value of the MAPI property PR_RECEIVED_BY_ENTRYID from this message.

Property Get ReceivedByName() As String

Returns the value of the MAPI property PR_RECEIVED_BY_NAME from this message.

Property Get ReceivedOnBehalfOfEntryID() As String

Returns the value of the MAPI property PR_RCVD_REPRESENTING_ENTRYID from this message.

Property Get ReceivedOnBehalfOfName() As String

Returns the value of the MAPI property PR_RCVD_REPRESENTING_NAME from this message.

Property Get ReceivedTime() As Date

Property Let ReceivedTime(ByVal RetVal As Date)

Returns/sets the value of the MAPI property PR_MESSAGE_DELIVERY_TIME from this message.

Property Get RecipientReassignmentProhibited() As Boolean

Property Let RecipientReassignmentProhibited(ByVal RetVal As Boolean)

Returns/sets the value of the MAPI property PR_RECIPIENT_REASSIGNMENT_PROHIBITED from this message.

Property Get ReplyRecipientNames() As String

Returns the value of the MAPI property PR_RCVD_REPRESENTING_NAME from this message.

Property Get SenderEmailAddress() As String

Property Let SenderEmailAddress(ByVal RetVal As String)

Returns the value of the MAPI property PR_SENDER_EMAIL_ADDRESS from this message.

Property Get SenderEmailType() As String

Property Let SenderEmailType(ByVal RetVal As String)

Returns the value of the MAPI property PR_SENDER_ADDRTYPE from this message.

Property Get SenderName() As String

Property Let SenderName(ByVal RetVal As String)

Returns the value of the MAPI property PR_SENDER_NAME from this message.

Property Get Sensitivity() As EnumSensitivity

Property Let Sensitivity(ByVal RetVal As EnumSensitivity)

Returns/sets the value of the MAPI property PR_SENSITIVITY from this message.

Property Get SentOn() As Date

Property Let SentOn(ByVal RetVal As Date)

Returns/sets the value of the MAPI property PR_CLIENT_SUBMIT_TIME from this message.

Property Get SentOnBehalfOfName() As String

Property Let SentOnBehalfOfName(ByVal RetVal As String)

Returns/sets the value of the MAPI property PR_SENT_REPRESENTING_NAME from this message.

Property Get SentOnBehalfOfEntryID() As String

Property Let SentOnBehalfOfEntryID(ByVal RetVal As String)

Returns the value of the MAPI property PR_SENT_REPRESENTING_ENTRYID from this message.

Property Get SentOnBehalfOfSearchKey() As String

Property Let SentOnBehalfOfSearchKey(ByVal RetVal As String)

Returns the value of the MAPI property PR_SENT_REPRESENTING_SEARCH_KEY from this message.

Property Get SentOnBehalfOfEmailAddress() As String

Property Let SentOnBehalfOfEmailAddress(ByVal RetVal As String)

Returns the value of the MAPI property PR_SENT_REPRESENTING_EMAIL_ADDRESS from this message.

Property Get SentOnBehalfOfAddressType() As String

Property Let SentOnBehalfOfAddressType(ByVal RetVal As String)

Returns the value of the MAPI property PR_SENT_REPRESENTING_ADDRTYPE from this message.

Property Get Size() As Long

Returns the value of the MAPI property PR_MESSAGE_SIZE from this message.

Property Get Subject() As String

Property Let Subject(ByVal RetVal As String)

Returns/sets the value of the MAPI property PR_SUBJECT from this message.

Property Get SenderEntryID() As String

Property Let SenderEntryID(ByVal RetVal As String)

Returns the value of the MAPI property PR_SENDER_ENTRYID from this message.

Property Get SenderSearchKey() As String

Property Let SenderSearchKey(ByVal RetVal As String)

Returns the value of the MAPI property PR_SENDER_SEARCH_KEY from this message.

Property Get SearchKey() As String

Returns the value of the MAPI property PR_SEARCH_KEY from this message.

Property Get ReadReceiptEntryID() As String

Property Let ReadReceiptEntryID(ByVal RetVal As String)

Returns the value of the MAPI property PR_READ_RECEIPT_ENTRYID from this message.

Property Get MessageFlags() As Long

Property Let MessageFlags(ByVal RetVal As Long)

Returns/sets the value of the MAPI property PR_MESSAGE_FLAGS from this message.

Property Get BillingInformation() As String

Property Let BillingInformation(ByVal Value As String)

Returns/sets the BillingInformation Outlook property.

Property Get OutlookInternalVersion() As Long

Property Let OutlookInternalVersion(ByVal Value As Long)

Returns/sets the OutlookInternalVersion Outlook property.

Property Get HidePaperClip() As Boolean

Property Let HidePaperClip(ByVal Value As Boolean)

Returns/sets the HidePaperClip Outlook property.

Property Get Mileage() As String

Property Let Mileage(ByVal Value As String)

Returns/sets the Mileage Outlook property.

Property Get NoAging() As Boolean

Property Let NoAging(ByVal Value As Boolean)

Returns/sets the NoAging Outlook property.

Property Get OutlookVersion() As String

Property Let OutlookVersion(ByVal Value As String)

Returns/sets the OutlookVersion Outlook property.

Property Get UseTnef() As Boolean

Property Let UseTnef(ByVal Value As Boolean)

Returns/sets the UseTnef Outlook property.

Property Get DownloadState() As EnumDownloadState

Retrieves the download state of the message (fully downloaded or header only).

Property Get UnRead() As Boolean

Property Let UnRead(ByVal Value As Boolean)

Returns/sets the read/unread status of the message.

Property Get Submitted() As Boolean

Property Let Submitted(ByVal Value As Boolean)

Returns/sets the submitted status of the message. Only updatable if message not yet saved.

Property Get Sent() As Boolean

Property Let Sent(ByVal Value As Boolean)

Returns/sets the sent status of the message. Only updatable if message not yet saved.

Property Get MAPIOBJECT() As Variant

Returns the IMessage object associated with this item.

Sub Display(Optional ByVal Modal As Boolean = True, _
              Optional ByVal ParentWindowHandle As Long)

Opens the MAPI form associated with this message (usually for end user editing).

Sub PrintOut()

Prints the MAPI form associated with this message.

Property Get Sender() As vbMAPI_AddressEntry

Returns the sender as an vbMAPI_AddressEntry object (as represented by the PR_SENDER_ENTRYID MAPI property).

Property Get SentOnBehalfOf() As vbMAPI_AddressEntry

Returns the SentOnBehalfOf as an vbMAPI_AddressEntry object (as represented by the PR_SENT_REPRESENTING MAPI property).

Property Get Session() As vbMAPI_Session

Returns the session object associated with this object.

Property Get Store() As vbMAPI_Store

Returns the store object associated with this object.

Property Get Parent() As vbMAPI_Folder

Returns the parent folder object associated with this object.

Sub Delete(Optional ByVal DeleteType As EnumDeleteType = DeleteType_MoveToDeletedItems)

Deletes the current message.  Use DeleteType parameter to specify whether the message moves to the deleted items folder or not.

Function Move(ByVal DestFolder As vbMAPI_Folder, _
              Optional ByVal ImplicitSave As Boolean = True) As vbMAPI_MailItem

Moves the current message into another folder and returns an object representing the new message.  The current message is invalid after the call.

Function Copy(ByVal DestFolder As vbMAPI_Folder, _
              Optional ByVal ImplicitSave As Boolean = True) As vbMAPI_MailItem

Copies the current message into another folder and returns an object representing the new message.  The current message is still valid after the call.

Sub SaveAs(ByVal FilePath As String, _
              Optional ByVal FileFormat As EnumMessageFileFormat = FileFormat_MSG)

Saves the current message to a file on disk.  Only MSG file formats currently supported.

Sub AbortSubmit()

Cancels a previously sent mail item, assuming it is still in the queue.

Sub MarkRead(Optional ByVal SuppressReadReceipt As Boolean = True)

Sets UnRead to false.  Allows you to suppress the generation of automatic read-receipts.

Function Reply() As vbMAPI_MailItem

Returns a new message object.

Function ReplyAll() As vbMAPI_MailItem

Returns a new message object.

Function Forward() As vbMAPI_MailItem

Returns a new message object.


Enumeration description: EnumDeleteType


DeleteType_MoveToDeletedItems = &H0
DeleteType_SoftDelete = &H1
DeleteType_HardDelete = &H2


Enumeration description: EnumFlagIcon


FlagIcon_NoFlagIcon = &H0
FlagIcon_PurpleFlagIcon = &H1
FlagIcon_OrangeFlagIcon = &H2
FlagIcon_GreenFlagIcon = &H3
FlagIcon_YellowFlagIcon = &H4
FlagIcon_BlueFlagIcon = &H5
FlagIcon_RedFlagIcon = &H6


Enumeration description: EnumFlagStatus


FlagStatus_NoFlag = &H0
FlagStatus_FlagComplete = &H1
FlagStatus_FlagMarked = &H2


Enumeration description: EnumImportance


Importance_Low = &H0
Importance_Normal = &H1
Importance_High = &H2


Enumeration description: EnumSensitivity


Sensitivity_Normal = &H0
Sensitivity_Personal = &H1
Sensitivity_Private = &H2
Sensitivity_Confidential = &H3


Enumeration description: EnumRecipientType


Recipient_TO = &H1
Recipient_CC = &H2
Recipient_BCC = &H3


Enumeration description: EnumMessageFileFormat


FileFormat_MSG = &H3
FileFormat_MSGUnicode = &H9


Enumeration description: EnumDownloadState


DownloadState_FullItem = &H1
DownloadState_HeaderOnly = &H0


Enumeration description: EnumBusyStatus


BusyStatus_Free = &H0
BusyStatus_Tentative = &H1
BusyStatus_Busy = &H2
BusyStatus_OutOfOffice = &H3