Class Message
Base class for all MAPI item types (email messages, appointments, contacts, tasks). Provides access to common MAPI properties defined in [MS-OXCMSG].
Inherited Members
Namespace: DRIT.Mail.Mapi.API
Assembly: DRIT.Mail.dll
Syntax
public class Message
Constructors
View SourceMessage(MapiMessage)
Initialises a new instance of Message backed by the given MAPI message node.
Declaration
public Message(MapiMessage mapiMessage)
Parameters
| Type | Name | Description |
|---|---|---|
| MapiMessage | mapiMessage | The underlying MAPI message property accessor. |
Properties
View SourceAlternateRecipientAllowed
Gets or sets whether the sender permits the message to be autoforwarded.
Declaration
public bool? AlternateRecipientAllowed { get; set; }
Property Value
| Type | Description |
|---|---|
| bool? |
Remarks
This property is set to True if autoforwarding is allowed.
Reference: MS-OXCMSG 2.2.1.36 PidTagAlternateRecipientAllowed Property Outlook 2013 > Outlook 2013 developer reference > MailItem.AlternateRecipientAllowed Property
AutoForwarded
Gets or sets whether this message has been automatically generated or automatically forwarded.
Declaration
public bool? AutoForwarded { get; set; }
Property Value
| Type | Description |
|---|---|
| bool? |
Remarks
If this property is unset, a default value of 0x00 is assumed.
Reference: MS-OXCMSG 2.2.1.20 PidTagAutoForwarded Property Outlook 2013 > Outlook 2013 developer reference > MailItem.AutoForwarded Property
Body
Get or sets unformatted text, which is the text/plain MIME format as specified in [RFC1521] section 7.1.2.
Declaration
public string Body { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Remarks
Reference: MS-OXCMSG 2.2.1.56.1 PidTagBody Property
BodyFormat
Get or sets the best available format for storing the message body.
Declaration
public BodyFormat BodyFormat { get; }
Property Value
| Type | Description |
|---|---|
| BodyFormat |
Remarks
The value of this property is limited to one of the property values shown in the following table.
Reference: 2.2.1.56.2 PidTagNativeBody Property
BodyRtf
Gets or sets the body rtf value.
Declaration
public string BodyRtf { get; }
Property Value
| Type | Description |
|---|---|
| string |
Categories
Gets or sets the array of text labels assigned to this Message object.
Declaration
public string[] Categories { get; set; }
Property Value
| Type | Description |
|---|---|
| string[] |
Remarks
Reference: MS-OXCMSG 2.2.1.22 PidLidCategories Property
Class
Gets or sets the logical item type of this message, derived from MessageClass.
Declaration
public Class? Class { get; set; }
Property Value
| Type | Description |
|---|---|
| Class? |
See Also
View SourceCodepage
Gets the code page used to encode the non-Unicode string properties on this Message object.
Declaration
public int? Codepage { get; set; }
Property Value
| Type | Description |
|---|---|
| int? |
Remarks
The Folder object code page is used if this property is set to 0x0000.
Reference: MS-OXCMSG 2.2.1.4 PidTagMessageCodepage Property
Companies
Gets or sets the list of company names associated with this message.
Declaration
public string[] Companies { get; set; }
Property Value
| Type | Description |
|---|---|
| string[] |
Remarks
Reference: MS-OXCMSG PidLidCompanies Property
CreationTime
Gets or sets the time that the object was created in Coordinated Universal Time (UTC).
Declaration
public DateTime? CreationTime { get; }
Property Value
| Type | Description |
|---|---|
| DateTime? |
Remarks
This property is read-only for clients.
Reference: MS-OXCPRPT 2.2.1.4 PidTagCreationTime Property
CultureInfo
Gets or sets the locale culture information for the message, derived from LocaleId.
Declaration
public CultureInfo CultureInfo { get; set; }
Property Value
| Type | Description |
|---|---|
| CultureInfo |
Encoding
Gets or sets the text encoding for the non-Unicode string properties, derived from Codepage.
Declaration
public Encoding Encoding { get; set; }
Property Value
| Type | Description |
|---|---|
| Encoding |
EntryID
Gets a a unique binary-comparable identifier for a specific object.
Declaration
public string EntryID { get; }
Property Value
| Type | Description |
|---|---|
| string |
Remarks
Whenever a copy of an object is created, the server generates a new identifier for the copied object.
Reference: MS-OXCPRPT 2.2.1.8 PidTagRecordKey Property
Flags
Gets a strongly typed view of the message status flags (PidTagMessageFlags).
Declaration
public MessageFlags Flags { get; }
Property Value
| Type | Description |
|---|---|
| MessageFlags |
Remarks
Reference: MS-OXCMSG 2.2.1.6 PidTagMessageFlags Property
Headers
Gets a typed, case-insensitive collection of the Internet message headers
parsed from the message's transport headers
(PidTagTransportMessageHeaders).
Declaration
public MailHeaderCollection Headers { get; }
Property Value
| Type | Description |
|---|---|
| MailHeaderCollection |
Remarks
The collection is lazily parsed on first access. Mutating the collection (adding, removing, or changing a header value) rebuilds the header block and writes it back to the underlying MAPI property. RFC 2047 encoded words are preserved in Value and exposed decoded through DecodedValue.
HtmlBody
Gets or sets the HTML body of the message.
Declaration
public string HtmlBody { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Remarks
Reference: MS-OXCMSG 2.2.1.56.3 PidTagBodyHtml Property
Importance
Gets or sets the level of importance assigned by the end user to the Message object.
Declaration
public Importance? Importance { get; set; }
Property Value
| Type | Description |
|---|---|
| Importance? |
Remarks
Reference: MS-OXCMSG 2.2.1.11 PidTagImportance Property
InternetCodepage
Gets or sets the code page used for the Body property or the BodyHtml property.
Declaration
public int? InternetCodepage { get; set; }
Property Value
| Type | Description |
|---|---|
| int? |
Remarks
Reference: MS-OXCMSG 2.2.1.56.6 PidTagInternetCodepage Property
IsConflict
This is a conflict resolve message as specified in [MS-OXCFXICS] section 3.1.5.6.2.1. This is a read-only value for the client.
Declaration
public bool IsConflict { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
IsRemoteDeletionMarked
The message has been marked for deletion at the remote message store without downloading to the local client.
Declaration
public bool IsRemoteDeletionMarked { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
LastModificationTime
Gets or sets the time of the last modification to the object in UTC.
Declaration
public DateTime? LastModificationTime { get; set; }
Property Value
| Type | Description |
|---|---|
| DateTime? |
Remarks
This property is read-only for clients.
Reference: MS-OXCPRPT 2.2.1.6 PidTagLastModificationTime Property
LocaleId
Gets or sets the language code identifier (LCID) of the end-user who created this message. For more details see [MS-LCID].
Declaration
public int? LocaleId { get; set; }
Property Value
| Type | Description |
|---|---|
| int? |
Remarks
Reference: MS-OXCMSG 2.2.1.5 PidTagMessageLocaleId Property
MarkForDownload
The message has been marked for downloading from the remote message store to the local client.
Declaration
public bool MarkForDownload { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
MessageClass
Gets or sets the message class string that identifies the type of the message object
(e.g. IPM.Note, IPM.Appointment).
Declaration
public string MessageClass { get; }
Property Value
| Type | Description |
|---|---|
| string |
Remarks
Must be 1–256 ASCII characters in the range 0x20–0x7F, and must not end with a period. Reference: MS-OXCMSG 2.2.1.3 PidTagMessageClass Property
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Thrown when the value is empty, longer than 256 characters, contains non-ASCII characters, or ends with a period. |
Mileage
Gets or sets the mileage information that is associated with an item.
Declaration
public string Mileage { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Remarks
Reference: Outlook 2013 MAPI Reference > Reference > Properties > PidLidMileage Canonical Property
NoAging
Gets or sets whether the message is to be automatically archived.
Declaration
public bool? NoAging { get; set; }
Property Value
| Type | Description |
|---|---|
| bool? |
Remarks
This property is set to True if the message will not be automatically archived; otherwise, False.
Reference: MS-OXCMSG 2.2.1.33 PidLidAgingDontAgeMe Property
Priority
Gets or sets the client's request for the priority at which the message is to be sent by the messaging system.
Declaration
public Priority? Priority { get; set; }
Property Value
| Type | Description |
|---|---|
| Priority? |
Remarks
Reference: MS-OXCMSG 2.2.1.12 PidTagPriority Property
Private
Gets or sets a value which is set to True if the end user wants this Message object to be hidden from other users who have access to the Message object.
Declaration
public bool? Private { get; set; }
Property Value
| Type | Description |
|---|---|
| bool? |
Remarks
Reference: MS-OXCMSG 2.2.1.15 PidLidPrivate Property
Reminder
Gets the reminder settings for this message.
Declaration
public Reminder Reminder { get; }
Property Value
| Type | Description |
|---|---|
| Reminder |
RetentionExpirationDate
Gets or sets the the date when the Message expires.
Declaration
public DateTime? RetentionExpirationDate { get; set; }
Property Value
| Type | Description |
|---|---|
| DateTime? |
Sensitivity
Gets or sets the sender's assessment of the sensitivity of the Message object.
Declaration
public virtual Sensitivity? Sensitivity { get; set; }
Property Value
| Type | Description |
|---|---|
| Sensitivity? |
Remarks
Reference: MS-OXCMSG 2.2.1.13 PidTagSensitivity Property
SideEffects
Gets or sets the flags that specify which standard operations should be suppressed for this message as it passes through the server.
Declaration
public SideEffects? SideEffects { get; set; }
Property Value
| Type | Description |
|---|---|
| SideEffects? |
Remarks
Reference: MS-OXCMSG PidLidSideEffects Property
Size
Gets or sets the size in bytes consumed by the Message object on the server.
Declaration
public int? Size { get; }
Property Value
| Type | Description |
|---|---|
| int? |
Remarks
This property is read-only for the client.
Reference: MS-OXCMSG 2.2.1.7 PidTagMessageSize Property
Subject
Gets or sets the subject of the message, stripping any control-character prefix bytes that encode the subject prefix (e.g. "RE:").
Declaration
public string Subject { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Remarks
The getter delegates to Subject, which strips the MAPI control-code prefix. The setter writes the prefix so that MSG files produced by DRIT.Mail match the Outlook encoding.
Reference: MS-OXCMSG 2.2.1.46 PidTagSubject Property
UnRead
Gets a value indicating whether this message has not yet been read.
Declaration
public bool UnRead { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Methods
View SourceCreate(MapiMessage)
Creates a new Message wrapping the given MAPI message node.
Declaration
public static Message Create(MapiMessage mapiMessage)
Parameters
| Type | Name | Description |
|---|---|---|
| MapiMessage | mapiMessage | The underlying MAPI message property accessor. |
Returns
| Type | Description |
|---|---|
| Message | A new Message instance. |
Save()
Stamps CreationTime (if not already set) and updates LastModificationTime to the current UTC time.
Declaration
public virtual void Save()
SetDefaultValues()
Sets the default values.
Declaration
protected virtual void SetDefaultValues()
SetSender(string)
Sets the sender address, using emailAddress as both the display name and address.
Declaration
public void SetSender(string emailAddress)
Parameters
| Type | Name | Description |
|---|---|---|
| string | emailAddress | The sender's SMTP e-mail address. |
SetSender(string, string)
Sets the sender display name and address.
Declaration
public void SetSender(string name, string emailAddress)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The display name of the sender. |
| string | emailAddress | The SMTP e-mail address of the sender. |
SetSentRepresenting(string, string)
Sets the sent-representing display name and address (the on-behalf-of user).
Declaration
public void SetSentRepresenting(string name, string emailAddress)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The display name of the on-behalf-of user. |
| string | emailAddress | The SMTP e-mail address of the on-behalf-of user. |