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.load("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

ConstructorDescription
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

MethodDescription
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.
checkSignature()Checking signature exsisting MapiMessage.
close()
createMapiNode(String key)Creates the mapi node.
decrypt()Decrypts this message
decrypt(byte[] certificateRawData, String certificatePassword)Decrypts this message
decrypt(System.Security.Cryptography.X509Certificates.X509Certificate2 certificate)Decrypts this message
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)
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(InputStream stream)Creates an instance of MapiMessage from the EML format data stream.
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.
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.
getSupportedType()Gets the supported item type.
getTransportMessageHeaders()Gets the transport-specific message envelope information.
hashCode()
isEncrypted()Gets a value indicating whether the message is encrypted.
isMsgFormat(InputStream stream)Determines whether the specified stream has a MSG format.
isMsgFormat(String fileName)Determines whether the specified file has a MSG format.
isSigned()Gets a value indicating whether the message is signed.
isStoreUnicodeOk()Determines if string properties are Unicode encoded or not.
isTemplate()Determines whether the message is Outlook template (.oft).
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.
removeSignature()Remove signature.
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:

ParameterTypeDescription
formatintDefines 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:

ParameterTypeDescription
fromjava.lang.StringThe From address.
tojava.lang.StringThe addresses of recipients. Note, that addresses are separated by semicolon.
subjectjava.lang.StringThe message subject.
bodyjava.lang.StringThe message body.
formatintDefines 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:

ParameterTypeDescription
fromjava.lang.StringThe From address.
tojava.lang.StringThe addresses of recipients. Note, that addresses are separated by semicolon.
subjectjava.lang.StringThe message subject.
bodyjava.lang.StringThe message body.

addCustomProperty(MapiProperty property, String stringNameId)

public final void addCustomProperty(MapiProperty property, String stringNameId)

Adds the custom property.

Parameters:

ParameterTypeDescription
propertyMapiPropertyThe propertyMapiProperty.
stringNameIdjava.lang.StringThe 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:

ParameterTypeDescription
typeintType of MapiPropertyMapiPropertyType
databyte[]MapiProperty data.byte
stringNameIdjava.lang.StringThe name of propertyString.

checkBounced()

public final BounceResult checkBounced()

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

Returns: BounceResult - Result of checkingBounceResult.

checkSignature()

public final System.Security.Cryptography.X509Certificates.X509Certificate2[] checkSignature()

Checking signature exsisting MapiMessage.

Returns: com.aspose.ms.System.Security.Cryptography.X509Certificates.X509Certificate2[] - X.509 signers certificates

close()

public void close()

createMapiNode(String key)

public IMapiNode createMapiNode(String key)

Creates the mapi node.

Parameters:

ParameterTypeDescription
keyjava.lang.StringThe node key.

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

decrypt()

public final MapiMessage decrypt()

Decrypts this message

Returns: MapiMessage - Decrypted MapiMessage


Method searches the current user and computer My stores for the appropriate certificate and private key.

decrypt(byte[] certificateRawData, String certificatePassword)

public final MapiMessage decrypt(byte[] certificateRawData, String certificatePassword)

Decrypts this message

Parameters:

ParameterTypeDescription
certificateRawDatabyte[]X509Certificate2
certificatePasswordjava.lang.String

Returns: MapiMessage - E-mail message

decrypt(System.Security.Cryptography.X509Certificates.X509Certificate2 certificate)

public final MapiMessage decrypt(System.Security.Cryptography.X509Certificates.X509Certificate2 certificate)

Decrypts this message

Parameters:

ParameterTypeDescription
certificatecom.aspose.ms.System.Security.Cryptography.X509Certificates.X509Certificate2System.Security.Cryptography.X509Certificates.X509Certificate2

Returns: MapiMessage - E-mail message

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:

ParameterTypeDescription
pathjava.lang.StringThe 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:

ParameterTypeDescription
arg0java.lang.Object

Returns: boolean

fromMailMessage(MailMessage message)

public static MapiMessage fromMailMessage(MailMessage message)

Creates an instance of MapiMessage from the MailMessage.

Parameters:

ParameterTypeDescription
messageMailMessageThe 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:

ParameterTypeDescription
messageMailMessageThe MailMessage.
optionsMapiConversionOptionsMapiFromMailMessageOptions MapiConversionOptions

Returns: MapiMessage - MapiMessage that represents Outlook message.

fromMailMessage(InputStream stream)

public static MapiMessage fromMailMessage(InputStream stream)

Creates an instance of MapiMessage from the EML format data stream.

Parameters:

ParameterTypeDescription
streamjava.io.InputStreamThe stream of data that represents an EML file.

Returns: MapiMessage - Returns a MapiMessage instance which is loaded from the EML format data stream.

fromMailMessage(String fileName)

public static MapiMessage fromMailMessage(String fileName)

Creates an instance of MapiMessage from the MailMessage.

Parameters:

ParameterTypeDescription
fileNamejava.lang.StringThe 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:

ParameterTypeDescription
propertiesMapiPropertyCollectionA collection of MapiProperty.

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

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:

ParameterTypeDescription
pdPropertyDescriptorProperty 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:

ParameterTypeDescription
taglongThe 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:

ParameterTypeDescription
taglongThe 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:

ParameterTypeDescription
keylongThe 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:

ParameterTypeDescription
taglongThe 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:

ParameterTypeDescription
taglongThe 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:

ParameterTypeDescription
taglongThe 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:

ParameterTypeDescription
taglongThe 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:

ParameterTypeDescription
taglongThe MAPI property tag.
codepageintThe 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

getSupportedType()

public final int getSupportedType()

Gets the supported item type.

Value: The MapiItemType.

Returns: int

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

isEncrypted()

public final boolean isEncrypted()

Gets a value indicating whether the message is encrypted.

Returns: boolean

isMsgFormat(InputStream stream)

public static boolean isMsgFormat(InputStream stream)

Determines whether the specified stream has a MSG format.

Parameters:

ParameterTypeDescription
streamjava.io.InputStreamThe 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:

ParameterTypeDescription
fileNamejava.lang.StringName of the file.

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

isSigned()

public final boolean isSigned()

Gets a value indicating whether the message is signed.

Returns: boolean

isStoreUnicodeOk()

public final boolean isStoreUnicodeOk()

Determines if string properties are Unicode encoded or not.

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

isTemplate()

public final boolean isTemplate()

Determines whether the message is Outlook template (.oft).

Returns: boolean - true if the message is OFT template; otherwise, false .

load(InputStream stream)

public static MapiMessage load(InputStream stream)

Loads message from stream.

Parameters:

ParameterTypeDescription
streamjava.io.InputStreamSource 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:

ParameterTypeDescription
streamjava.io.InputStreamSource streamjava.io.InputStream.
optionsLoadOptionsAdditional options LoadOptions.

Returns: MapiMessage -

load(String fileName)

public static MapiMessage load(String fileName)

Loads message from file.

Parameters:

ParameterTypeDescription
fileNamejava.lang.StringSource 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:

ParameterTypeDescription
fileNamejava.lang.StringSource file pathString.
optionsLoadOptionsAdditional options LoadOptions.

Returns: MapiMessage -

loadFromTnef(InputStream stream)

public static MapiMessage loadFromTnef(InputStream stream)

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

Parameters:

ParameterTypeDescription
streamjava.io.InputStreamA 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:

ParameterTypeDescription
fileNamejava.lang.StringName 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:

ParameterTypeDescription
pathjava.lang.StringThe 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:

ParameterTypeDescription
taglongThe tag of MapiProperty.

removeSignature()

public final MapiMessage removeSignature()

Remove signature.

Returns: MapiMessage - Unsigned MapiMessage message

save(OutputStream stream)

public final void save(OutputStream stream)

Saves to the specified stream as Msg.

Parameters:

ParameterTypeDescription
streamjava.io.OutputStreamThe stream.

save(OutputStream stream, SaveOptions options)

public final void save(OutputStream stream, SaveOptions options)

Saves message as a stream with additional options.

Parameters:

ParameterTypeDescription
streamjava.io.OutputStreamStream into which message is saved.
optionsSaveOptionsAdditional options for savingSaveOptions.

save(String fileName)

public final void save(String fileName)

Saves to the specified file as Msg.

Parameters:

ParameterTypeDescription
fileNamejava.lang.StringName 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:

ParameterTypeDescription
fileNamejava.lang.StringStream into which message is saved.
optionsSaveOptionsAdditional options for savingSaveOptions.

saveAsTemplate(OutputStream stream)

public final void saveAsTemplate(OutputStream stream)

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

Parameters:

ParameterTypeDescription
streamjava.io.OutputStreamThe stream.

saveAsTemplate(String fileName)

public final void saveAsTemplate(String fileName)

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

Parameters:

ParameterTypeDescription
fileNamejava.lang.StringName of the file.

saveAsTnef(OutputStream stream)

public final void saveAsTnef(OutputStream stream)

Save message in TNEF format.

Parameters:

ParameterTypeDescription
streamjava.io.OutputStreamThe stream where a message will be saved to.

saveAsTnef(String fileName)

public final void saveAsTnef(String fileName)

Save message in TNEF format.

Parameters:

ParameterTypeDescription
fileNamejava.lang.StringName 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:

ParameterTypeDescription
valuejava.lang.String

setBody(String value)

public final void setBody(String value)

Gets the message text.

Value: The string that represents message body.

Parameters:

ParameterTypeDescription
valuejava.lang.String

setBodyContent(String content, int contentType)

public void setBodyContent(String content, int contentType)

Sets the content of the body.

Parameters:

ParameterTypeDescription
contentjava.lang.StringThe content.
contentTypeintType 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:

ParameterTypeDescription
contentjava.lang.StringThe content.
contentTypeintType of the content.
compressionbooleanSpecify 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:

ParameterTypeDescription
valuejava.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:

ParameterTypeDescription
valuejava.lang.String
compressionbooleanSpecify that the content should be compressed.

setCategories(String[] value)

public final void setCategories(String[] value)

Contains keywords or categories for the message object.

Parameters:

ParameterTypeDescription
valuejava.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:

ParameterTypeDescription
valuejava.util.Date

setCompanies(String[] value)

public final void setCompanies(String[] value)

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

Parameters:

ParameterTypeDescription
valuejava.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:

ParameterTypeDescription
valuejava.util.Date

setHeaders(HeaderCollection value)

public final void setHeaders(HeaderCollection value)

Gets the transport message headers

Parameters:

ParameterTypeDescription
valueHeaderCollection

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:

ParameterTypeDescription
valuejava.lang.String

setMessageFlags(long flags)

public final void setMessageFlags(long flags)

Sets the message flags.

Parameters:

ParameterTypeDescription
flagslongThe message flags.

setMileage(String value)

public final void setMileage(String value)

Contains the mileage information that is associated with an item.

Parameters:

ParameterTypeDescription
valuejava.lang.String

setNamedPropertyMapping(MapiNamedPropertyMappingStorage value)

public final void setNamedPropertyMapping(MapiNamedPropertyMappingStorage value)

Sets the named property mapping.

Parameters:

ParameterTypeDescription
valueMapiNamedPropertyMappingStorageThe MapiNamedPropertyMappingStorage.

setProperty(MapiAttachment value, long signed, long key)

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

Sets the attachment.

Parameters:

ParameterTypeDescription
valueMapiAttachmentThe property value.
signedlongThe value, that indicates that the property is signed.
keylongThe property tag.

setProperty(MapiProperty value)

public void setProperty(MapiProperty value)

Sets the property.

Parameters:

ParameterTypeDescription
valueMapiPropertyThe property.

setProperty(MapiRecipient value, long signed, long key)

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

Sets the recipient.

Parameters:

ParameterTypeDescription
valueMapiRecipientThe property value.
signedlongThe value, that indicates that the property is signed.
keylongThe property tag.

setProperty(PropertyDescriptor pd, Object value)

public void setProperty(PropertyDescriptor pd, Object value)

Sets MAPI property.

Parameters:

ParameterTypeDescription
pdPropertyDescriptorThe property descriptor.
valuejava.lang.ObjectThe 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:

ParameterTypeDescription
valueboolean

setRecipients(MapiRecipientCollection value)

public final void setRecipients(MapiRecipientCollection value)

Gets the recipients of the message.

Value: The collection of recipients.

Parameters:

ParameterTypeDescription
valueMapiRecipientCollection

setReplyTo(String value)

public final void setReplyTo(String value)

Gets or sets the reply to names.

Parameters:

ParameterTypeDescription
valuejava.lang.String

setSenderEmailAddress(String value)

public final void setSenderEmailAddress(String value)

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

Parameters:

ParameterTypeDescription
valuejava.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:

ParameterTypeDescription
valuejava.lang.String

setSenderSmtpAddress(String value)

public final void setSenderSmtpAddress(String value)

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

Parameters:

ParameterTypeDescription
valuejava.lang.String

setSensitivity(int value)

public final void setSensitivity(int value)

Gets the Sensitivity.

Value: The sensitivity.

Parameters:

ParameterTypeDescription
valueint

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:

ParameterTypeDescription
valuejava.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:

ParameterTypeDescription
valuejava.lang.String

setStringPropertyValue(long tag, String value)

public final void setStringPropertyValue(long tag, String value)

Sets the string property value.

Parameters:

ParameterTypeDescription
taglongThe property tag.
valuejava.lang.StringThe 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:

ParameterTypeDescription
valuejava.lang.String

toMailMessage(MailConversionOptions options)

public final MailMessage toMailMessage(MailConversionOptions options)

Creates an instance of MailMessage from this MapiMessage.

Parameters:

ParameterTypeDescription
optionsMailConversionOptionsAllows 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:

ParameterTypeDescription
taglongThe 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:

ParameterTypeDescription
taglongThe MAPI property tag.
valuejava.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:

ParameterTypeDescription
taglongThe MAPI property tag.
valueint[]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:

ParameterTypeDescription
taglongThe MAPI property tag.
valuelong[]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:

ParameterTypeDescription
taglongThe 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:

ParameterTypeDescription
taglongThe property tag key.
codepageintThe 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:

ParameterTypeDescription
taglongThe MAPI property tag.
valuejava.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:

ParameterTypeDescription
taglongThe MAPI property tag.
valuejava.lang.String[]When this method returns, contains the value of the specified property, if the property exists. This parameter is passed uninitialized.
codepageintThe 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:

ParameterTypeDescription
arg0long

wait(long arg0, int arg1)

public final void wait(long arg0, int arg1)

Parameters:

ParameterTypeDescription
arg0long
arg1int