MapiMessage Class

Represents an Outlook Message format document that can be parsed.
Inheritance Hierarchy

Namespace:  Aspose.Email.Mapi
Assembly:  Aspose.Email (in Aspose.Email.dll) Version: 20.10
Syntax
public sealed class MapiMessage : MapiMessageItemBase

The MapiMessage type exposes the following members.

Constructors
  NameDescription
Public methodMapiMessage
Initializes a new instance of the MapiMessage class.
Public methodMapiMessage(OutlookMessageFormat)
Initializes a new instance of the MapiMessage class.
Public methodMapiMessage(String, String, String, String)
Initializes a new instance of the MapiMessage class.
Public methodMapiMessage(String, String, String, String, OutlookMessageFormat)
Initializes a new instance of the MapiMessage class.
Properties
  NameDescription
Public propertyAttachments
Gets the attachments in the message.
(Inherited from MapiMessageItemBase.)
Public propertyBilling
Contains the billing information associated with an item.
(Inherited from MapiMessageItemBase.)
Public propertyBody
Gets the message text.
Public propertyBodyHtml
Gets the BodyRtf of the message converted to HTML, if present, otherwise an empty string.
(Inherited from MapiMessageItemBase.)
Public propertyBodyRtf
Gets or sets the RTF formatted message text.
(Inherited from MapiMessageItemBase.)
Public propertyBodyType
Gets the type of the body.
(Inherited from MapiMessageItemBase.)
Public propertyCategories
Contains keywords or categories for the message object.
(Inherited from MapiMessageItemBase.)
Public propertyClientSubmitTime
Gets or sets the date and time the message sender submitted a message.
Public propertyCodePage
Gets the code page.
(Inherited from MapiPropertyContainer.)
Public propertyCompanies
Contains the names of the companies that are associated with an item.
(Inherited from MapiMessageItemBase.)
Public propertyConversationTopic
Gets the topic of the first message in a conversation thread.
Public propertyDeliveryTime
Gets or sets the date and time a message was delivered.
Public propertyDisplayBcc
Gets a list of the display names of any blind carbon copy (BCC) message recipients, separated by semicolons (;).
Public propertyDisplayCc
Gets a list of the display names of any carbon copy (CC) message recipients, separated by semicolons (;).
Public propertyDisplayName
Gets the display name for the message.
Public propertyDisplayNamePrefix
Gets a prefix of the display name.
Public propertyDisplayTo
Gets a list of the display names of the primary (To) message recipients, separated by semicolons (;).
Public propertyFlags
Gets the message flags.
Public propertyHeaders
Gets the transport message headers
Public propertyInternetMessageId
Gets the message id of the message.
Public propertyItemId
The item id, uses with a server
(Inherited from MapiMessageItemBase.)
Public propertyMessageClass
Gets a case-sensitive string that identifies the sender-defined message class, such as IPM.Note. The message class specifies the type, purpose, or content of the message.
(Inherited from MapiMessageItemBase.)
Public propertyMessageFormat
Gets the outlook message format.
Public propertyMileage
Contains the mileage information that is associated with an item.
(Inherited from MapiMessageItemBase.)
Public propertyNamedProperties
Gets the named properties of message.
(Inherited from MapiMessageItemBase.)
Public propertyNamedPropertyMapping
Gets the named property mapping.
(Inherited from MapiMessageItemBase.)
Public propertyNormalizedSubject
Gets normalized subject of the message.
Public propertyProperties
Gets the collection of properties.
(Inherited from MapiPropertyContainer.)
Public propertyPropertyStream
Gets the property stream.
(Inherited from MapiMessageItemBase.)
Public propertyReadReceiptRequested
Gets or sets a value indicating whether the read receipt is requested.
Public propertyRecipients
Gets the recipients of the message.
(Inherited from MapiMessageItemBase.)
Public propertyReplyTo
Gets or sets the reply to names.
Public propertySenderAddressType
Gets the message sender's e-mail address type.
Public propertySenderEmailAddress
Gets or sets the message sender's e-mail address.
Public propertySenderName
Gets or sets the message sender's display name.
Public propertySenderSmtpAddress
Gets or sets the message sender's e-mail address.
Public propertySensitivity
Gets the Sensitivity.
(Inherited from MapiMessageItemBase.)
Public propertySentRepresentingAddressType
Gets the address type for the messaging user represented by the sender.
Public propertySentRepresentingEmailAddress
Gets or sets the e-mail address for the messaging user represented by the sender.
Public propertySentRepresentingName
Gets or sets the display name for the messaging user represented by the sender.
Public propertySentRepresentingSmtpAddress
Gets or sets the e-mail address for the messaging user represented by the sender.
Public propertySubject
Gets or sets the subject of the message.
(Inherited from MapiMessageItemBase.)
Public propertySubjectPrefix
Gets a subject prefix that typically indicates some action on a message, such as "FW: " for forwarding.
(Inherited from MapiMessageItemBase.)
Public propertySubStorages
Gets the sub storages.
(Inherited from MapiMessageItemBase.)
Public propertyTransportMessageHeaders
Gets the transport-specific message envelope information.
Methods
  NameDescription
Public methodAddCustomProperty(MapiProperty, String)
Adds the custom property.
Public methodAddCustomProperty(MapiPropertyType, Byte, String)
Adds the custom property.
Public methodCheckBounced
Checks whether this message can be treated as a bounce message.
Public methodClone
Creates a new object that is a copy of the current instance.
Public methodStatic memberCode exampleDestroyAttachments
Destroies the attachments in the specified Outlook Message files. DestroyAttachments will ignore the attachment parsing.
Public methodDispose
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
(Inherited from MapiMessageItemBase.)
Public methodEquals (Inherited from Object.)
Public methodStatic memberFromFile
Create an instance of MapiMessage from the specified file.
Public methodStatic memberFromMailMessage(String)
Creates an instance of MapiMessage from the MailMessage.
Public methodStatic memberFromMailMessage(MailMessage)
Creates an instance of MapiMessage from the MailMessage.
Public methodStatic memberFromMailMessage(MailMessage, MapiConversionOptions)
Creates an instance of MapiMessage from the MailMessage.
Public methodStatic memberFromProperties
Creates an instance of MapiMessage from a collection of Mapi properties.
Public methodStatic memberFromStream
Create an instance of MapiMessage from the specified stream.
Public methodGetCustomProperties
Gets collection of custom MapiProperties.
Public methodGetHashCode (Inherited from Object.)
Public methodGetProperty
Gets MAPI property by property descriptor.
(Inherited from MapiMessageItemBase.)
Public methodGetPropertyBoolean
Gets the value of the property specified by tag as Boolean type.
(Inherited from MapiPropertyContainer.)
Public methodGetPropertyBytes
Gets the string value of the property specified by tag.
(Inherited from MapiPropertyContainer.)
Public methodGetPropertyDateTime
Gets the value of the property specified by tag as DateTime type.
(Inherited from MapiPropertyContainer.)
Public methodGetPropertyInt32
Gets the int32 value of the property specified by tag.
(Inherited from MapiPropertyContainer.)
Public methodGetPropertyLong
Gets the value of the property specified by tag as Long (int64) type.
(Inherited from MapiPropertyContainer.)
Public methodGetPropertyShort
Gets the value of the property specified by tag as Short type.
(Inherited from MapiPropertyContainer.)
Public methodGetPropertyString(Int64)
Gets the string value of the property specified by tag.
(Inherited from MapiPropertyContainer.)
Public methodGetPropertyString(Int64, Int32)
Gets the string value of the property specified by tag.
(Inherited from MapiPropertyContainer.)
Public methodGetType (Inherited from Object.)
Public methodStatic memberIsMsgFormat(Stream)
Determines whether the specified stream has a MSG format.
Public methodStatic memberIsMsgFormat(String)
Determines whether the specified file has a MSG format.
Public methodIsStoreUnicodeOk
Determines if string properties are Unicode encoded or not.
(Inherited from MapiPropertyContainer.)
Public methodStatic memberLoad(Stream, LoadOptions)
Loads message from stream with additional options.
Public methodStatic memberLoad(String, LoadOptions)
Loads message from file with additional options.
Public methodStatic memberLoadFromTnef(Stream)
Loads message from Transport Neutral Encapsulation Format (TNEF) data structure
Public methodStatic memberLoadFromTnef(String)
Loads message from Transport Neutral Encapsulation Format (TNEF) data structure
Public methodStatic memberCode exampleRemoveAttachments
Removes all of the attachments from the specified Outlook Message files.
Public methodRemoveProperty
Provides correctly removing property from all collections.
(Inherited from MapiMessageItemBase.)
Public methodSave(Stream)
Saves to the specified stream as Msg.
Public methodSave(String)
Saves to the specified file as Msg.
Public methodSave(Stream, SaveOptions)
Saves message as a stream with additional options.
Public methodSave(String, SaveOptions)
Saves message as a file with additional options.
Public methodSaveAsTemplate(Stream)
Saves to the specified stream as Outlook File Template(OFT format).
Public methodSaveAsTemplate(String)
Saves to the specified file as Outlook File Template(OFT format).
Public methodSaveAsTnef(Stream)
Save message in TNEF format.
Public methodSaveAsTnef(String)
Save message in TNEF format.
Public methodSetBodyContent(String, BodyContentType)
Sets the content of the body.
(Inherited from MapiMessageItemBase.)
Public methodSetBodyContent(String, BodyContentType, Boolean)
Sets the content of the body.
(Inherited from MapiMessageItemBase.)
Public methodSetBodyRtf
Gets or sets the RTF formatted message text.
(Inherited from MapiMessageItemBase.)
Public methodSetMessageFlags
Sets the message flags.
(Inherited from MapiMessageItemBase.)
Public methodSetProperty(MapiProperty)
Sets the property.
(Inherited from MapiPropertyContainer.)
Public methodSetProperty(PropertyDescriptor, Object)
Sets MAPI property.
(Inherited from MapiMessageItemBase.)
Public methodSetStringPropertyValue
Sets the string property value.
Public methodToMailMessage
Creates an instance of MailMessage from this MapiMessage.
Public methodToMapiMessageItem
Convert MapiMessage to IMapiMessageItem object in dependence with MessageClass.
Public methodToString (Inherited from Object.)
Public methodTryGetPropertyData
Try to get the property data with specified tag key.
(Inherited from MapiPropertyContainer.)
Public methodTryGetPropertyDateTime
Gets the value of the specified property as DateTime type. A return value indicates whether the operation succeeded.
(Inherited from MapiPropertyContainer.)
Public methodTryGetPropertyInt32
Gets the value of the specified property as Int32 type. A return value indicates whether the operation succeeded.
(Inherited from MapiPropertyContainer.)
Public methodTryGetPropertyLong
Gets the value of the specified property as Long type. A return value indicates whether the operation succeeded.
(Inherited from MapiPropertyContainer.)
Public methodTryGetPropertyString(Int64)
Try to get a property data as string with specified tag.
(Inherited from MapiPropertyContainer.)
Public methodTryGetPropertyString(Int64, Int32)
Try to get a property data as string with specified tag and code page.
(Inherited from MapiPropertyContainer.)
Public methodTryGetPropertyString(Int64, String)
Gets the value of the specified property as String type. A return value indicates whether the operation succeeded.
(Inherited from MapiPropertyContainer.)
Public methodTryGetPropertyString(Int64, String, Int32)
Gets the value of the specified property as String type. A return value indicates whether the operation succeeded.
(Inherited from MapiPropertyContainer.)
Remarks
Instances of the MapiMessage class are used to represent Microsoft Outlook Message document files that are parsed by MapiMessageReader class. To access the sender, recipient, and contents of an e-mail message, use the associated properties of the MapiMessage class.
Examples

The following exmaple demonstrates how to read Outlook Message files.

[C#]

 //Open Outlook Message files
 MapiMessage msg = MapiMessage.FromFile(@"c:\outlookmessage.msg");

//read subject
Console.WriteLine("Subject:" + msg.Subject);

//sender name
Console.WriteLine("From:" + msg.SenderName);

//message body
Console.WriteLine("Body:" + msg.Body);

//Attachments
foreach(MapiAttachment att in msg.Attachments)
{
    Console.WriteLine("Attachment Name:"+att.FileName);
    att.Save(att.FileName);
}

[Visual Basic]

'Open Outlook Message files 
Dim msg As MapiMessage = MapiMessage.FromFile("c:\outlookmessage.msg") 

'read subject 
Console.WriteLine("Subject:" + msg.Subject) 

'sender name 
Console.WriteLine("From:" + msg.SenderName) 

'message body 
Console.WriteLine("Body:" + msg.Body) 

'Attachments 
For Each att As MapiAttachment In msg.Attachments 
    Console.WriteLine("Attachment Name:" + att.FileName) 
    att.Save(att.FileName) 
Next
See Also