MapiMessage

Inheritance: java.lang.Object, com.aspose.email.MapiPropertyContainer, com.aspose.email.MapiMessageItemBase

public final class MapiMessage extends MapiMessageItemBase

Represents an Outlook Message format document that can be parsed.


The following exmaple demonstrates how to read Outlook Message files.

[Java]

//Open Outlook Message files
  MapiMessage msg = MapiMessage.fromFile("outlookmessage.msg");

  //read subject
  System.out.print("Subject:" + msg.getSubject());

  //sender name
  System.out.print("From:" + msg.getSenderName());

  //message body
  System.out.print("Body:" + msg.getBody());

  //Attachments
  for(MapiAttachment att : msg.getAttachments())
  {
      System.out.print("Attachment Name:"+att.getFileName());
      att.save(att.getFileName());
  }

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.

Constructors

Constructor Description
MapiMessage() Initializes a new instance of the MapiMessage class.
MapiMessage(int format) Initializes a new instance of the MapiMessage class.
MapiMessage(String from, String to, String subject, String body, int format) Initializes a new instance of the MapiMessage class.
MapiMessage(String from, String to, String subject, String body) Initializes a new instance of the MapiMessage class.

Methods

Method Description
addCustomProperty(MapiProperty property, String stringNameId) Adds the custom property.
addCustomProperty(int type, byte[] data, String stringNameId) Adds the custom property.
checkBounced() Checks whether this message can be treated as a bounce message.
close()
createMapiNode(String key) Creates the mapi node.
deepClone() Creates a new object that is a copy of the current instance.
destroyAttachments(String path) Destroies the attachments in the specified Outlook Message files.
dispose() Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
equals(Object arg0)
fromFile(String path) Create an instance of MapiMessage from the specified file.
fromMailMessage(MailMessage message) Creates an instance of MapiMessage from the MailMessage.
fromMailMessage(MailMessage message, MapiConversionOptions options) Creates an instance of MapiMessage from the MailMessage.
fromMailMessage(String fileName) Creates an instance of MapiMessage from the MailMessage.
fromProperties(MapiPropertyCollection properties) Creates an instance of MapiMessage from a collection of Mapi properties.
fromStream(InputStream stream) Create an instance of MapiMessage from the specified stream.
getAttachments() Gets the attachments in the message.
getBilling() Contains the billing information associated with an item.
getBody() Gets the message text.
getBodyHtml() Gets the BodyRtf (#getBodyRtf.getBodyRtf/#setBodyRtf(String).setBodyRtf(String)) of the message converted to HTML, if present, otherwise an empty string.
getBodyRtf() Gets or sets the RTF formatted message text.
getBodyType() Gets the type of the body.
getCategories() Contains keywords or categories for the message object.
getClass()
getClientSubmitTime() Gets or sets the date and time the message sender submitted a message.
getCodePage() Gets the code page.
getCompanies() Contains the names of the companies that are associated with an item.
getConversationTopic() Gets the topic of the first message in a conversation thread.
getCustomProperties() Gets collection of custom MapiProperties.
getDeliveryTime() Gets or sets the date and time a message was delivered.
getDisplayBcc() Gets a list of the display names of any blind carbon copy (BCC) message recipients, separated by semicolons (;).
getDisplayCc() Gets a list of the display names of any carbon copy (CC) message recipients, separated by semicolons (;).
getDisplayName() Gets the display name for the message.
getDisplayNamePrefix() Gets a prefix of the display name.
getDisplayTo() Gets a list of the display names of the primary (To) message recipients, separated by semicolons (;).
getFlags() Gets the message flags.
getHeaders() Gets the transport message headers
getInternetMessageId() Gets the message id of the message.
getItemId() The item id, uses with a server
getMessageClass() Gets a case-sensitive string that identifies the sender-defined message class, such as IPM.Note.
getMessageFormat() Gets the outlook message format.
getMileage() Contains the mileage information that is associated with an item.
getNamedProperties() Gets the named properties of message.
getNamedPropertyMapping() Gets the named property mapping.
getNormalizedSubject() Gets normalized subject of the message.
getProperties() Gets the collection of properties.
getProperty(PropertyDescriptor pd) Gets MAPI property by property descriptor.
getPropertyBoolean(long tag) Gets the value of the property specified by tag as Boolean type.
getPropertyBytes(long tag) Gets the string value of the property specified by tag.
getPropertyDateTime(long key) Gets the value of the property specified by tag as DateTime type.
getPropertyInt32(long tag) Gets the int32 value of the property specified by tag.
getPropertyLong(long tag) Gets the value of the property specified by tag as Long (int64) type.
getPropertyShort(long tag) Gets the value of the property specified by tag as Short type.
getPropertyStream() Gets the property stream.
getPropertyString(long tag) Gets the string value of the property specified by tag.
getPropertyString(long tag, int codepage) Gets the string value of the property specified by tag.
getReadReceiptRequested() Gets or sets a value indicating whether the read receipt is requested.
getRecipients() Gets the recipients of the message.
getReplyTo() Gets or sets the reply to names.
getSenderAddressType() Gets the message sender’s e-mail address type.
getSenderEmailAddress() Gets or sets the message sender’s e-mail address.
getSenderName() Gets or sets the message sender’s display name.
getSenderSmtpAddress() Gets or sets the message sender’s e-mail address.
getSensitivity() Gets the Sensitivity.
getSentRepresentingAddressType() Gets the address type for the messaging user represented by the sender.
getSentRepresentingEmailAddress() Gets or sets the e-mail address for the messaging user represented by the sender.
getSentRepresentingName() Gets or sets the display name for the messaging user represented by the sender.
getSentRepresentingSmtpAddress() Gets or sets the e-mail address for the messaging user represented by the sender.
getSubStorages() Gets the sub storages.
getSubject() Gets or sets the subject of the message.
getSubjectPrefix() Gets a subject prefix that typically indicates some action on a message, such as “FW: " for forwarding.
getTransportMessageHeaders() Gets the transport-specific message envelope information.
hashCode()
isMsgFormat(InputStream stream) Determines whether the specified stream has a MSG format.
isMsgFormat(String fileName) Determines whether the specified file has a MSG format.
isStoreUnicodeOk() Determines if string properties are Unicode encoded or not.
load(InputStream stream) Loads message from stream.
load(InputStream stream, LoadOptions options) Loads message from stream with additional options.
load(String fileName) Loads message from file.
load(String fileName, LoadOptions options) Loads message from file with additional options.
loadFromTnef(InputStream stream) Loads message from Transport Neutral Encapsulation Format (TNEF) data structure
loadFromTnef(String fileName) Loads message from Transport Neutral Encapsulation Format (TNEF) data structure
notify()
notifyAll()
removeAttachments(String path) Removes all of the attachments from the specified Outlook Message files.
removeProperty(long tag) Provides correctly removing property from all collections.
save(OutputStream stream) Saves to the specified stream as Msg.
save(OutputStream stream, SaveOptions options) Saves message as a stream with additional options.
save(String fileName) Saves to the specified file as Msg.
save(String fileName, SaveOptions options) Saves message as a file with additional options.
saveAsTemplate(OutputStream stream) Saves to the specified stream as Outlook File Template(OFT format).
saveAsTemplate(String fileName) Saves to the specified file as Outlook File Template(OFT format).
saveAsTnef(OutputStream stream) Save message in TNEF format.
saveAsTnef(String fileName) Save message in TNEF format.
setBilling(String value) Contains the billing information associated with an item.
setBody(String value) Gets the message text.
setBodyContent(String content, int contentType) Sets the content of the body.
setBodyContent(String content, int contentType, boolean compression) Sets the content of the body.
setBodyRtf(String value) Gets or sets the RTF formatted message text.
setBodyRtf(String value, boolean compression) Gets or sets the RTF formatted message text.
setCategories(String[] value) Contains keywords or categories for the message object.
setClientSubmitTime(Date value) Gets or sets the date and time the message sender submitted a message.
setCompanies(String[] value) Contains the names of the companies that are associated with an item.
setDeliveryTime(Date value) Gets or sets the date and time a message was delivered.
setHeaders(HeaderCollection value) Gets the transport message headers
setMessageClass(String value) Gets a case-sensitive string that identifies the sender-defined message class, such as IPM.Note.
setMessageFlags(long flags) Sets the message flags.
setMileage(String value) Contains the mileage information that is associated with an item.
setNamedPropertyMapping(MapiNamedPropertyMappingStorage value) Sets the named property mapping.
setProperty(MapiAttachment value, long signed, long key) Sets the attachment.
setProperty(MapiProperty value) Sets the property.
setProperty(MapiRecipient value, long signed, long key) Sets the recipient.
setProperty(PropertyDescriptor pd, Object value) Sets MAPI property.
setReadReceiptRequested(boolean value) Gets or sets a value indicating whether the read receipt is requested.
setRecipients(MapiRecipientCollection value) Gets the recipients of the message.
setReplyTo(String value) Gets or sets the reply to names.
setSenderEmailAddress(String value) Gets or sets the message sender’s e-mail address.
setSenderName(String value) Gets or sets the message sender’s display name.
setSenderSmtpAddress(String value) Gets or sets the message sender’s e-mail address.
setSensitivity(int value) Gets the Sensitivity.
setSentRepresentingEmailAddress(String value) Gets or sets the e-mail address for the messaging user represented by the sender.
setSentRepresentingName(String value) Gets or sets the display name for the messaging user represented by the sender.
setStringPropertyValue(long tag, String value) Sets the string property value.
setSubject(String value) Gets or sets the subject of the message.
toMailMessage(MailConversionOptions options) Creates an instance of MailMessage from this MapiMessage.
toMapiMessageItem() Convert MapiMessage to IMapiMessageItem object in dependence with MessageClass.
toString()
tryGetPropertyData(long tag) Try to get the property data with specified tag key.
tryGetPropertyDateTime(long tag, Date[] value) Gets the value of the specified property as DateTime type.
tryGetPropertyInt32(long tag, int[] value) Gets the value of the specified property as Int32 type.
tryGetPropertyLong(long tag, long[] value) Gets the value of the specified property as Long type.
tryGetPropertyString(long tag) Try to get a property data as string with specified tag.
tryGetPropertyString(long tag, int codepage) Try to get a property data as string with specified tag and code page.
tryGetPropertyString(long tag, String[] value) Gets the value of the specified property as String type.
tryGetPropertyString(long tag, String[] value, int codepage) Gets the value of the specified property as String type.
wait()
wait(long arg0)
wait(long arg0, int arg1)

MapiMessage()

public MapiMessage()

Initializes a new instance of the MapiMessage class.

MapiMessage(int format)

public MapiMessage(int format)

Initializes a new instance of the MapiMessage class.

Parameters:

Parameter Type Description
format int Defines whether to use Unicode or ASCII encoding for this message.

MapiMessage(String from, String to, String subject, String body, int format)

public MapiMessage(String from, String to, String subject, String body, int format)

Initializes a new instance of the MapiMessage class.

Parameters:

Parameter Type Description
from java.lang.String The From address.
to java.lang.String The addresses of recipients. Note, that addresses are separated by semicolon.
subject java.lang.String The message subject.
body java.lang.String The message body.
format int Defines whether to use Unicode or ASCII encoding for this message.

MapiMessage(String from, String to, String subject, String body)

public MapiMessage(String from, String to, String subject, String body)

Initializes a new instance of the MapiMessage class.

Parameters:

Parameter Type Description
from java.lang.String The From address.
to java.lang.String The addresses of recipients. Note, that addresses are separated by semicolon.
subject java.lang.String The message subject.
body java.lang.String The message body.

addCustomProperty(MapiProperty property, String stringNameId)

public final void addCustomProperty(MapiProperty property, String stringNameId)

Adds the custom property.

Parameters:

Parameter Type Description
property MapiProperty The propertyMapiProperty.
stringNameId java.lang.String The name of propertyString.

addCustomProperty(int type, byte[] data, String stringNameId)

public final void addCustomProperty(int type, byte[] data, String stringNameId)

Adds the custom property.

Parameters:

Parameter Type Description
type int Type of MapiPropertyMapiPropertyType
data byte[] MapiProperty data.byte
stringNameId java.lang.String The name of propertyString.

checkBounced()

public final BounceResult checkBounced()

Checks whether this message can be treated as a bounce message.

Returns: BounceResult - Result of checkingBounceResult.

close()

public void close()

createMapiNode(String key)

public IMapiNode createMapiNode(String key)

Creates the mapi node.

Parameters:

Parameter Type Description
key java.lang.String The node key.

Returns: com.aspose.email.IMapiNode - The IMapiNode interface.

deepClone()

public final MapiMessage deepClone()

Creates a new object that is a copy of the current instance.

Returns: MapiMessage - A new object that is a copy of this instance.

destroyAttachments(String path)

public static void destroyAttachments(String path)

Destroies the attachments in the specified Outlook Message files. DestroyAttachments will ignore the attachment parsing.


The following exmaple demonstrates how to destroy attachments in Outlook Message files.

[Java]

//Destroy attachments from Outlook Message files
     MapiMessage.destroyAttachment("outlookmessage.msg");

Parameters:

Parameter Type Description
path java.lang.String The name of the Outlook Message file.

dispose()

public void dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

equals(Object arg0)

public boolean equals(Object arg0)

Parameters:

Parameter Type Description
arg0 java.lang.Object

Returns: boolean

fromFile(String path)

public static MapiMessage fromFile(String path)

Create an instance of MapiMessage from the specified file.

Parameters:

Parameter Type Description
path java.lang.String The name of the file to be loaded.

Returns: MapiMessage - Returns a MapiMessage instance which is loaded from the specified file.

fromMailMessage(MailMessage message)

public static MapiMessage fromMailMessage(MailMessage message)

Creates an instance of MapiMessage from the MailMessage.

Parameters:

Parameter Type Description
message MailMessage The MailMessage.

Returns: MapiMessage - Returns a MapiMessage instance which is loaded from the MailMessage.

fromMailMessage(MailMessage message, MapiConversionOptions options)

public static MapiMessage fromMailMessage(MailMessage message, MapiConversionOptions options)

Creates an instance of MapiMessage from the MailMessage.

Parameters:

Parameter Type Description
message MailMessage The MailMessage.
options MapiConversionOptions MapiFromMailMessageOptions MapiConversionOptions

Returns: MapiMessage - MapiMessage that represents Outlook message.

fromMailMessage(String fileName)

public static MapiMessage fromMailMessage(String fileName)

Creates an instance of MapiMessage from the MailMessage.

Parameters:

Parameter Type Description
fileName java.lang.String The file name of MailMessage.

Returns: MapiMessage - Returns a MapiMessage instance which is loaded from the MailMessage.

fromProperties(MapiPropertyCollection properties)

public static MapiMessage fromProperties(MapiPropertyCollection properties)

Creates an instance of MapiMessage from a collection of Mapi properties.

Parameters:

Parameter Type Description
properties MapiPropertyCollection A collection of MapiProperty.

Returns: MapiMessage - Returns a MapiMessage instance which is loaded from the specified properties.

fromStream(InputStream stream)

public static MapiMessage fromStream(InputStream stream)

Create an instance of MapiMessage from the specified stream.

Parameters:

Parameter Type Description
stream java.io.InputStream The stream to be loaded.

Returns: MapiMessage - Returns a MapiMessage instance which is loaded from the specified stream.

getAttachments()

public final MapiAttachmentCollection getAttachments()

Gets the attachments in the message.

Value: The attachment collection.

Returns: MapiAttachmentCollection

getBilling()

public final String getBilling()

Contains the billing information associated with an item.

Returns: java.lang.String

getBody()

public final String getBody()

Gets the message text.

Value: The string that represents message body.

Returns: java.lang.String

getBodyHtml()

public final String getBodyHtml()

Gets the BodyRtf (#getBodyRtf.getBodyRtf/#setBodyRtf(String).setBodyRtf(String)) of the message converted to HTML, if present, otherwise an empty string.

Returns: java.lang.String

getBodyRtf()

public final String getBodyRtf()

Gets or sets the RTF formatted message text.

Value: The string that represents message body rtf.


When setting a value, the values of PR_RTF_COMPRESSED, PR_RTF_DECOMPRESSES, PR_BODY properties are updated. A string value being set must have RTF format. Thus, if it is necessary to set a value in HTML format, the value must be first to encoded within RTF, according to RTF Extensions Specification. To set the content of the body message in HTML or Plain Text formats quickly, please, use SetBodyContent method. When setting a null value or empty string, the values of BodyRtf and Body properties are set null.

Returns: java.lang.String

getBodyType()

public final int getBodyType()

Gets the type of the body.

Value: The type of the body.

Returns: int

getCategories()

public final String[] getCategories()

Contains keywords or categories for the message object.

Returns: java.lang.String[]

getClass()

public final native Class<?> getClass()

Returns: java.lang.Class

getClientSubmitTime()

public final Date getClientSubmitTime()

Gets or sets the date and time the message sender submitted a message.

Value: The DateTime that represents client submit time.


If the property was not available, DateTime.MinValue is returned.

Returns: java.util.Date

getCodePage()

public int getCodePage()

Gets the code page.

Value: The code page.

Returns: int

getCompanies()

public final String[] getCompanies()

Contains the names of the companies that are associated with an item.

Returns: java.lang.String[]

getConversationTopic()

public final String getConversationTopic()

Gets the topic of the first message in a conversation thread.

Value: The string that represens conversation topic.

Returns: java.lang.String

getCustomProperties()

public final MapiPropertyCollection getCustomProperties()

Gets collection of custom MapiProperties.

Returns: MapiPropertyCollection - Collection of custom MapiPropertiesMapiPropertyCollection.

getDeliveryTime()

public final Date getDeliveryTime()

Gets or sets the date and time a message was delivered.

Value: The DateTime that represents delivery time.


If the property was not available, DateTime.MinValue is returned.

Returns: java.util.Date

getDisplayBcc()

public final String getDisplayBcc()

Gets a list of the display names of any blind carbon copy (BCC) message recipients, separated by semicolons (;).

Value: The string that represents display bcc.

Returns: java.lang.String

getDisplayCc()

public final String getDisplayCc()

Gets a list of the display names of any carbon copy (CC) message recipients, separated by semicolons (;).

Value: The string that represents display cc.

Returns: java.lang.String

getDisplayName()

public final String getDisplayName()

Gets the display name for the message.

Value: The string that represents display name.

Returns: java.lang.String

getDisplayNamePrefix()

public final String getDisplayNamePrefix()

Gets a prefix of the display name.

Value: The string that represents display name prefix.

Returns: java.lang.String

getDisplayTo()

public final String getDisplayTo()

Gets a list of the display names of the primary (To) message recipients, separated by semicolons (;).

Value: The string that represents display to.

Returns: java.lang.String

getFlags()

public final long getFlags()

Gets the message flags.

Value: The message flags.

Returns: long

getHeaders()

public final HeaderCollection getHeaders()

Gets the transport message headers

Returns: HeaderCollection

getInternetMessageId()

public final String getInternetMessageId()

Gets the message id of the message.

Value: The string that represents internet message id.

Returns: java.lang.String

getItemId()

public String getItemId()

The item id, uses with a server

Returns: java.lang.String

getMessageClass()

public final String getMessageClass()

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.

Value: The string that represents message class.

Returns: java.lang.String

getMessageFormat()

public final int getMessageFormat()

Gets the outlook message format.

Value: The outlook message format.

Returns: int

getMileage()

public final String getMileage()

Contains the mileage information that is associated with an item.

Returns: java.lang.String

getNamedProperties()

public final MapiPropertyCollection getNamedProperties()

Gets the named properties of message.

Value: The collection of named properties.

Returns: MapiPropertyCollection

getNamedPropertyMapping()

public final MapiNamedPropertyMappingStorage getNamedPropertyMapping()

Gets the named property mapping.

Value: The named property mapping.

Returns: MapiNamedPropertyMappingStorage

getNormalizedSubject()

public final String getNormalizedSubject()

Gets normalized subject of the message.

Value: The string that represents normalized subject.

Returns: java.lang.String

getProperties()

public MapiPropertyCollection getProperties()

Gets the collection of properties.

Value: The properties.

Returns: MapiPropertyCollection

getProperty(PropertyDescriptor pd)

public MapiProperty getProperty(PropertyDescriptor pd)

Gets MAPI property by property descriptor.

Parameters:

Parameter Type Description
pd PropertyDescriptor Property descriptor for looked property

Returns: MapiProperty - Mapi property if it is found, otherwise null.

getPropertyBoolean(long tag)

public final Boolean getPropertyBoolean(long tag)

Gets the value of the property specified by tag as Boolean type.

Parameters:

Parameter Type Description
tag long The MAPI property tag.

Returns: java.lang.Boolean - The value of the property. If the property does not exist, returns NULL; otherwise, returns the value.

getPropertyBytes(long tag)

public final byte[] getPropertyBytes(long tag)

Gets the string value of the property specified by tag.

Parameters:

Parameter Type Description
tag long The MAPI property tag.

Returns: byte[] - The value of the property. If the property does not exist, returns NULL; otherwise, returns the value.

getPropertyDateTime(long key)

public final Date getPropertyDateTime(long key)

Gets the value of the property specified by tag as DateTime type.

Parameters:

Parameter Type Description
key long The MAPI property tag.

Returns: java.util.Date - The value of the property. If the property does not exist, returns NULL; otherwise, returns the value.

getPropertyInt32(long tag)

public final Integer getPropertyInt32(long tag)

Gets the int32 value of the property specified by tag.

Parameters:

Parameter Type Description
tag long The MAPI property tag.

Returns: java.lang.Integer - The value of the property. If the property does not exist, returns NULL; otherwise, returns the value.

getPropertyLong(long tag)

public final Long getPropertyLong(long tag)

Gets the value of the property specified by tag as Long (int64) type.

Parameters:

Parameter Type Description
tag long The MAPI property tag.

Returns: java.lang.Long - The value of the property. If the property does not exist, returns NULL; otherwise, returns the value.

getPropertyShort(long tag)

public final Short getPropertyShort(long tag)

Gets the value of the property specified by tag as Short type.

Parameters:

Parameter Type Description
tag long The MAPI property tag.

Returns: java.lang.Short - The value of the property. If the property does not exist, returns NULL; otherwise, returns the value.

getPropertyStream()

public final MapiPropertyStream getPropertyStream()

Gets the property stream.

Value: The property stream.

Returns: MapiPropertyStream

getPropertyString(long tag)

public final String getPropertyString(long tag)

Gets the string value of the property specified by tag.

Parameters:

Parameter Type Description
tag long The MAPI property tag.

Returns: java.lang.String - The value of the property. If the property does not exist, returns NULL; otherwise, returns the value.

getPropertyString(long tag, int codepage)

public final String getPropertyString(long tag, int codepage)

Gets the string value of the property specified by tag.

Parameters:

Parameter Type Description
tag long The MAPI property tag.
codepage int The specified codepage used to get string value.

Returns: java.lang.String - The value of the property. If the property does not exist, returns NULL; otherwise, returns the value.

getReadReceiptRequested()

public final boolean getReadReceiptRequested()

Gets or sets a value indicating whether the read receipt is requested.

Value: true if the read receipt is requested; otherwise, false .

Returns: boolean

getRecipients()

public final MapiRecipientCollection getRecipients()

Gets the recipients of the message.

Value: The collection of recipients.

Returns: MapiRecipientCollection

getReplyTo()

public final String getReplyTo()

Gets or sets the reply to names.

Returns: java.lang.String

getSenderAddressType()

public final String getSenderAddressType()

Gets the message sender’s e-mail address type.

Value: The string that represents sender address type.

Returns: java.lang.String

getSenderEmailAddress()

public final String getSenderEmailAddress()

Gets or sets the message sender’s e-mail address.

Returns: java.lang.String

getSenderName()

public final String getSenderName()

Gets or sets the message sender’s display name.

Value: The the string that represents sender name.


When setting a null value or empty string, the values of the property get the value equal to SenderEmailAddress.

Returns: java.lang.String

getSenderSmtpAddress()

public final String getSenderSmtpAddress()

Gets or sets the message sender’s e-mail address.

Returns: java.lang.String

getSensitivity()

public final int getSensitivity()

Gets the Sensitivity.

Value: The sensitivity.

Returns: int

getSentRepresentingAddressType()

public final String getSentRepresentingAddressType()

Gets the address type for the messaging user represented by the sender.

Value: The string that represents sent representing address type.

Returns: java.lang.String

getSentRepresentingEmailAddress()

public final String getSentRepresentingEmailAddress()

Gets or sets the e-mail address for the messaging user represented by the sender.

Returns: java.lang.String

getSentRepresentingName()

public final String getSentRepresentingName()

Gets or sets the display name for the messaging user represented by the sender.

Value: The string that represents sent representing name.


When setting a null value or empty string, the values of the property are set in SentRepresentingEmailAddress.

Returns: java.lang.String

getSentRepresentingSmtpAddress()

public final String getSentRepresentingSmtpAddress()

Gets or sets the e-mail address for the messaging user represented by the sender.

Value: The string that represents sent representing email address.

Returns: java.lang.String

getSubStorages()

public final MapiPropertyCollection getSubStorages()

Gets the sub storages.

Value: The sub storages.

Returns: MapiPropertyCollection

getSubject()

public final String getSubject()

Gets or sets the subject of the message.

Value: The string that represents message subject.


When setting a value, the values of SubjectPrefix(PR_SUBJECT_PREFIX) and NormalizedSubject(PR_NORMALIZED_SUBJECT) properties are updated as well. If Subject has no prefix, the value of SubjectPrefix property is set null. When setting a null value or empty string, the values of Subject, SubjectPrefix, NormalizedSubject properties are set null.

Returns: java.lang.String

getSubjectPrefix()

public final String getSubjectPrefix()

Gets a subject prefix that typically indicates some action on a message, such as “FW: " for forwarding.

Value: The string that represents subject prefix.

Returns: java.lang.String

getTransportMessageHeaders()

public final String getTransportMessageHeaders()

Gets the transport-specific message envelope information.

Value: The string that represents transport message headers.

Returns: java.lang.String

hashCode()

public native int hashCode()

Returns: int

isMsgFormat(InputStream stream)

public static boolean isMsgFormat(InputStream stream)

Determines whether the specified stream has a MSG format.

Parameters:

Parameter Type Description
stream java.io.InputStream The message stream.

Returns: boolean - true if the stream is represented in MSG format]; otherwise, false .

isMsgFormat(String fileName)

public static boolean isMsgFormat(String fileName)

Determines whether the specified file has a MSG format.

Parameters:

Parameter Type Description
fileName java.lang.String Name of the file.

Returns: boolean - true if the file is represented in MSG format; otherwise, false .

isStoreUnicodeOk()

public final boolean isStoreUnicodeOk()

Determines if string properties are Unicode encoded or not.

Returns: boolean - True, if string properties are Unicode encoded.

load(InputStream stream)

public static MapiMessage load(InputStream stream)

Loads message from stream.

Parameters:

Parameter Type Description
stream java.io.InputStream Source streamjava.io.InputStream.

Returns: MapiMessage -

load(InputStream stream, LoadOptions options)

public static MapiMessage load(InputStream stream, LoadOptions options)

Loads message from stream with additional options.

Parameters:

Parameter Type Description
stream java.io.InputStream Source streamjava.io.InputStream.
options LoadOptions Additional options LoadOptions.

Returns: MapiMessage -

load(String fileName)

public static MapiMessage load(String fileName)

Loads message from file.

Parameters:

Parameter Type Description
fileName java.lang.String Source file pathString.

Returns: MapiMessage -

load(String fileName, LoadOptions options)

public static MapiMessage load(String fileName, LoadOptions options)

Loads message from file with additional options.

Parameters:

Parameter Type Description
fileName java.lang.String Source file pathString.
options LoadOptions Additional options LoadOptions.

Returns: MapiMessage -

loadFromTnef(InputStream stream)

public static MapiMessage loadFromTnef(InputStream stream)

Loads message from Transport Neutral Encapsulation Format (TNEF) data structure

Parameters:

Parameter Type Description
stream java.io.InputStream A stream representing message data in TNEF format

Returns: MapiMessage - A read MapiMessage

loadFromTnef(String fileName)

public static MapiMessage loadFromTnef(String fileName)

Loads message from Transport Neutral Encapsulation Format (TNEF) data structure

Parameters:

Parameter Type Description
fileName java.lang.String Name of file containing message data in TNEF format

Returns: MapiMessage - A read MapiMessage

notify()

public final native void notify()

notifyAll()

public final native void notifyAll()

removeAttachments(String path)

public static MapiAttachmentCollection removeAttachments(String path)

Removes all of the attachments from the specified Outlook Message files.


The following exmaple demonstrates how to destroy attachments in Outlook Message files.

[Java]

//Remove attachments from Outlook Message files
     MapiAttachmentCollection attachments = MapiMessage.removeAttachments("outlookmessage.msg");

     //Attachments
     for(MapiAttachment att : attachments)
     {
        System.out.print("Attachment Name:"+att.getFileName());
        att.save(att.getFileName());
     }

Parameters:

Parameter Type Description
path java.lang.String The name of the Outlook Message file.

Returns: MapiAttachmentCollection - The attachments collection.

removeProperty(long tag)

public final void removeProperty(long tag)

Provides correctly removing property from all collections.

Parameters:

Parameter Type Description
tag long The tag of MapiProperty.

save(OutputStream stream)

public final void save(OutputStream stream)

Saves to the specified stream as Msg.

Parameters:

Parameter Type Description
stream java.io.OutputStream The stream.

save(OutputStream stream, SaveOptions options)

public final void save(OutputStream stream, SaveOptions options)

Saves message as a stream with additional options.

Parameters:

Parameter Type Description
stream java.io.OutputStream Stream into which message is saved.
options SaveOptions Additional options for savingSaveOptions.

save(String fileName)

public final void save(String fileName)

Saves to the specified file as Msg.

Parameters:

Parameter Type Description
fileName java.lang.String Name of the file.

save(String fileName, SaveOptions options)

public final void save(String fileName, SaveOptions options)

Saves message as a file with additional options.

Parameters:

Parameter Type Description
fileName java.lang.String Stream into which message is saved.
options SaveOptions Additional options for savingSaveOptions.

saveAsTemplate(OutputStream stream)

public final void saveAsTemplate(OutputStream stream)

Saves to the specified stream as Outlook File Template(OFT format).

Parameters:

Parameter Type Description
stream java.io.OutputStream The stream.

saveAsTemplate(String fileName)

public final void saveAsTemplate(String fileName)

Saves to the specified file as Outlook File Template(OFT format).

Parameters:

Parameter Type Description
fileName java.lang.String Name of the file.

saveAsTnef(OutputStream stream)

public final void saveAsTnef(OutputStream stream)

Save message in TNEF format.

Parameters:

Parameter Type Description
stream java.io.OutputStream The stream where a message will be saved to.

saveAsTnef(String fileName)

public final void saveAsTnef(String fileName)

Save message in TNEF format.

Parameters:

Parameter Type Description
fileName java.lang.String Name of the file where a message will be saved to.

setBilling(String value)

public final void setBilling(String value)

Contains the billing information associated with an item.

Parameters:

Parameter Type Description
value java.lang.String

setBody(String value)

public final void setBody(String value)

Gets the message text.

Value: The string that represents message body.

Parameters:

Parameter Type Description
value java.lang.String

setBodyContent(String content, int contentType)

public void setBodyContent(String content, int contentType)

Sets the content of the body.

Parameters:

Parameter Type Description
content java.lang.String The content.
contentType int Type of the content.

It is provided for setting of the content of the body message in RTF, HTML or Plain Text formats. When setting a value, the values of PR_RTF_COMPRESSED, PR_RTF_DECOMPRESSES, PR_BODY properties are updated as well. Note, after the value in HTML format is set, BodyRtf property returns the value which is encoded within RTF. |

setBodyContent(String content, int contentType, boolean compression)

public void setBodyContent(String content, int contentType, boolean compression)

Sets the content of the body.

Parameters:

Parameter Type Description
content java.lang.String The content.
contentType int Type of the content.
compression boolean Specify that the content should be compressed.

It is provided for setting of the content of the body message in RTF, HTML or Plain Text formats. When setting a value, the values of PR_RTF_COMPRESSED, PR_RTF_DECOMPRESSES, PR_BODY properties are updated as well. Note, after the value in HTML format is set, BodyRtf property returns the value which is encoded within RTF. |

setBodyRtf(String value)

public final void setBodyRtf(String value)

Gets or sets the RTF formatted message text.

Value: The string that represents message body rtf.


When setting a value, the values of PR_RTF_COMPRESSED, PR_RTF_DECOMPRESSES, PR_BODY properties are updated. A string value being set must have RTF format. Thus, if it is necessary to set a value in HTML format, the value must be first to encoded within RTF, according to RTF Extensions Specification. To set the content of the body message in HTML or Plain Text formats quickly, please, use SetBodyContent method. When setting a null value or empty string, the values of BodyRtf and Body properties are set null.

Parameters:

Parameter Type Description
value java.lang.String

setBodyRtf(String value, boolean compression)

public final void setBodyRtf(String value, boolean compression)

Gets or sets the RTF formatted message text.

Value: The string that represents message body rtf.


When setting a value, the values of PR_RTF_COMPRESSED, PR_RTF_DECOMPRESSES, PR_BODY properties are updated. A string value being set must have RTF format. Thus, if it is necessary to set a value in HTML format, the value must be first to encoded within RTF, according to RTF Extensions Specification. To set the content of the body message in HTML or Plain Text formats quickly, please, use SetBodyContent method. When setting a null value or empty string, the values of BodyRtf and Body properties are set null.

Parameters:

Parameter Type Description
value java.lang.String
compression boolean Specify that the content should be compressed.

setCategories(String[] value)

public final void setCategories(String[] value)

Contains keywords or categories for the message object.

Parameters:

Parameter Type Description
value java.lang.String[]

setClientSubmitTime(Date value)

public final void setClientSubmitTime(Date value)

Gets or sets the date and time the message sender submitted a message.

Value: The DateTime that represents client submit time.


If the property was not available, DateTime.MinValue is returned.

Parameters:

Parameter Type Description
value java.util.Date

setCompanies(String[] value)

public final void setCompanies(String[] value)

Contains the names of the companies that are associated with an item.

Parameters:

Parameter Type Description
value java.lang.String[]

setDeliveryTime(Date value)

public final void setDeliveryTime(Date value)

Gets or sets the date and time a message was delivered.

Value: The DateTime that represents delivery time.


If the property was not available, DateTime.MinValue is returned.

Parameters:

Parameter Type Description
value java.util.Date

setHeaders(HeaderCollection value)

public final void setHeaders(HeaderCollection value)

Gets the transport message headers

Parameters:

Parameter Type Description
value HeaderCollection

setMessageClass(String value)

public final void setMessageClass(String value)

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.

Value: The string that represents message class.

Parameters:

Parameter Type Description
value java.lang.String

setMessageFlags(long flags)

public final void setMessageFlags(long flags)

Sets the message flags.

Parameters:

Parameter Type Description
flags long The message flags.

setMileage(String value)

public final void setMileage(String value)

Contains the mileage information that is associated with an item.

Parameters:

Parameter Type Description
value java.lang.String

setNamedPropertyMapping(MapiNamedPropertyMappingStorage value)

public final void setNamedPropertyMapping(MapiNamedPropertyMappingStorage value)

Sets the named property mapping.

Parameters:

Parameter Type Description
value MapiNamedPropertyMappingStorage The MapiNamedPropertyMappingStorage.

setProperty(MapiAttachment value, long signed, long key)

public void setProperty(MapiAttachment value, long signed, long key)

Sets the attachment.

Parameters:

Parameter Type Description
value MapiAttachment The property value.
signed long The value, that indicates that the property is signed.
key long The property tag.

setProperty(MapiProperty value)

public void setProperty(MapiProperty value)

Sets the property.

Parameters:

Parameter Type Description
value MapiProperty The property.

setProperty(MapiRecipient value, long signed, long key)

public void setProperty(MapiRecipient value, long signed, long key)

Sets the recipient.

Parameters:

Parameter Type Description
value MapiRecipient The property value.
signed long The value, that indicates that the property is signed.
key long The property tag.

setProperty(PropertyDescriptor pd, Object value)

public void setProperty(PropertyDescriptor pd, Object value)

Sets MAPI property.

Parameters:

Parameter Type Description
pd PropertyDescriptor The property descriptor.
value java.lang.Object The property data.

setReadReceiptRequested(boolean value)

public final void setReadReceiptRequested(boolean value)

Gets or sets a value indicating whether the read receipt is requested.

Value: true if the read receipt is requested; otherwise, false .

Parameters:

Parameter Type Description
value boolean

setRecipients(MapiRecipientCollection value)

public final void setRecipients(MapiRecipientCollection value)

Gets the recipients of the message.

Value: The collection of recipients.

Parameters:

Parameter Type Description
value MapiRecipientCollection

setReplyTo(String value)

public final void setReplyTo(String value)

Gets or sets the reply to names.

Parameters:

Parameter Type Description
value java.lang.String

setSenderEmailAddress(String value)

public final void setSenderEmailAddress(String value)

Gets or sets the message sender’s e-mail address.

Parameters:

Parameter Type Description
value java.lang.String

setSenderName(String value)

public final void setSenderName(String value)

Gets or sets the message sender’s display name.

Value: The the string that represents sender name.


When setting a null value or empty string, the values of the property get the value equal to SenderEmailAddress.

Parameters:

Parameter Type Description
value java.lang.String

setSenderSmtpAddress(String value)

public final void setSenderSmtpAddress(String value)

Gets or sets the message sender’s e-mail address.

Parameters:

Parameter Type Description
value java.lang.String

setSensitivity(int value)

public final void setSensitivity(int value)

Gets the Sensitivity.

Value: The sensitivity.

Parameters:

Parameter Type Description
value int

setSentRepresentingEmailAddress(String value)

public final void setSentRepresentingEmailAddress(String value)

Gets or sets the e-mail address for the messaging user represented by the sender.

Parameters:

Parameter Type Description
value java.lang.String

setSentRepresentingName(String value)

public final void setSentRepresentingName(String value)

Gets or sets the display name for the messaging user represented by the sender.

Value: The string that represents sent representing name.


When setting a null value or empty string, the values of the property are set in SentRepresentingEmailAddress.

Parameters:

Parameter Type Description
value java.lang.String

setStringPropertyValue(long tag, String value)

public final void setStringPropertyValue(long tag, String value)

Sets the string property value.

Parameters:

Parameter Type Description
tag long The property tag.
value java.lang.String The property value.

setSubject(String value)

public final void setSubject(String value)

Gets or sets the subject of the message.

Value: The string that represents message subject.


When setting a value, the values of SubjectPrefix(PR_SUBJECT_PREFIX) and NormalizedSubject(PR_NORMALIZED_SUBJECT) properties are updated as well. If Subject has no prefix, the value of SubjectPrefix property is set null. When setting a null value or empty string, the values of Subject, SubjectPrefix, NormalizedSubject properties are set null.

Parameters:

Parameter Type Description
value java.lang.String

toMailMessage(MailConversionOptions options)

public final MailMessage toMailMessage(MailConversionOptions options)

Creates an instance of MailMessage from this MapiMessage.

Parameters:

Parameter Type Description
options MailConversionOptions Allows to specify additional options when converting from MapiMessage to MailMessage.

Returns: MailMessage - Returns a MailMessage instance which is loaded from this MapiMessage.

toMapiMessageItem()

public final IMapiMessageItem toMapiMessageItem()

Convert MapiMessage to IMapiMessageItem object in dependence with MessageClass.

Returns: IMapiMessageItem - The IMapiMessageItem interface.

toString()

public String toString()

Returns: java.lang.String

tryGetPropertyData(long tag)

public final byte[] tryGetPropertyData(long tag)

Try to get the property data with specified tag key.

Parameters:

Parameter Type Description
tag long The tag key.

Returns: byte[] - The property data.

tryGetPropertyDateTime(long tag, Date[] value)

public final boolean tryGetPropertyDateTime(long tag, Date[] value)

Gets the value of the specified property as DateTime type. A return value indicates whether the operation succeeded.

Parameters:

Parameter Type Description
tag long The MAPI property tag.
value java.util.Date[] When this method returns, contains the value of the specified property, if the property exists. This parameter is passed uninitialized.

Returns: boolean - true if s was converted successfully; otherwise, false.

tryGetPropertyInt32(long tag, int[] value)

public final boolean tryGetPropertyInt32(long tag, int[] value)

Gets the value of the specified property as Int32 type. A return value indicates whether the operation succeeded.

Parameters:

Parameter Type Description
tag long The MAPI property tag.
value int[] When this method returns, contains the value of the specified property, if the property exists. This parameter is passed uninitialized.

Returns: boolean - true if s was converted successfully; otherwise, false.

tryGetPropertyLong(long tag, long[] value)

public final boolean tryGetPropertyLong(long tag, long[] value)

Gets the value of the specified property as Long type. A return value indicates whether the operation succeeded.

Parameters:

Parameter Type Description
tag long The MAPI property tag.
value long[] When this method returns, contains the value of the specified property, if the property exists. This parameter is passed uninitialized.

Returns: boolean - true if s was converted successfully; otherwise, false.

tryGetPropertyString(long tag)

public final String tryGetPropertyString(long tag)

Try to get a property data as string with specified tag.

Parameters:

Parameter Type Description
tag long The property tag key.

Returns: java.lang.String - String that contains the contents of property data.

tryGetPropertyString(long tag, int codepage)

public final String tryGetPropertyString(long tag, int codepage)

Try to get a property data as string with specified tag and code page.

Parameters:

Parameter Type Description
tag long The property tag key.
codepage int The code page.

Returns: java.lang.String - String that contains the contents of property data.

tryGetPropertyString(long tag, String[] value)

public final boolean tryGetPropertyString(long tag, String[] value)

Gets the value of the specified property as String type. A return value indicates whether the operation succeeded.

Parameters:

Parameter Type Description
tag long The MAPI property tag.
value java.lang.String[] When this method returns, contains the value of the specified property, if the property exists. This parameter is passed uninitialized.

Returns: boolean - true if s was converted successfully; otherwise, false.

tryGetPropertyString(long tag, String[] value, int codepage)

public final boolean tryGetPropertyString(long tag, String[] value, int codepage)

Gets the value of the specified property as String type. A return value indicates whether the operation succeeded.

Parameters:

Parameter Type Description
tag long The MAPI property tag.
value java.lang.String[] When this method returns, contains the value of the specified property, if the property exists. This parameter is passed uninitialized.
codepage int The specified codepage used to get string value.

Returns: boolean - true if s was converted successfully; otherwise, false.

wait()

public final void wait()

wait(long arg0)

public final native void wait(long arg0)

Parameters:

Parameter Type Description
arg0 long

wait(long arg0, int arg1)

public final void wait(long arg0, int arg1)

Parameters:

Parameter Type Description
arg0 long
arg1 int