|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.aspose.email.MapiPropertyContainer
com.aspose.email.MapiMessage
public final class MapiMessage
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()); }
Constructor Summary | |
---|---|
MapiMessage()
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. |
|
MapiMessage(String from,
String to,
String subject,
String body,
int format)
Initializes a new instance of the MapiMessage class. |
Method Summary | |
---|---|
com.aspose.email.IMapiNode |
createMapiNode(String tag)
Creates the mapi node. |
Object |
deepClone()
Creates a new object that is a copy of the current instance. |
static void |
destroyAttachments(String path)
Destroies the attachments in the specified Outlook Message files. |
void |
dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. |
static MapiMessage |
fromFile(String path)
Create an instance of MapiMessage from the specified file. |
static MapiMessage |
fromMailMessage(MailMessage message)
Creates an instance of MapiMessage from the MailMessage. |
static MapiMessage |
fromMailMessage(MailMessage message,
int format)
Creates an instance of MapiMessage from the MailMessage. |
static MapiMessage |
fromMailMessage(MailMessage message,
int format,
boolean preserveSignature)
Creates an instance of MapiMessage from the MailMessage. |
static MapiMessage |
fromMailMessage(String fileName)
Creates an instance of MapiMessage from the MailMessage. |
static MapiMessage |
fromProperties(MapiPropertyCollection properties)
Creates an instance of MapiMessage from a collection of Mapi properties. |
static MapiMessage |
fromStream(InputStream stream)
|
MapiAttachmentCollection |
getAttachments()
Gets the attachments in the message. |
String |
getBody()
Gets the message text. |
String |
getBodyHtml()
Gets the BodyRtf of the message converted to HTML, if present, otherwise an empty string. |
String |
getBodyRtf()
Gets or sets the RTF formatted message text. |
int |
getBodyType()
Gets the type of the body. |
Date |
getClientSubmitTime()
|
String |
getConversationTopic()
Gets the topic of the first message in a conversation thread. |
Date |
getDeliveryTime()
|
String |
getDisplayBcc()
Gets a list of the display names of any blind carbon copy (BCC) message recipients, separated by semicolons (;). |
String |
getDisplayCc()
Gets a list of the display names of any carbon copy (CC) message recipients, separated by semicolons (;). |
String |
getDisplayName()
Gets the display name for the message. |
String |
getDisplayNamePrefix()
Gets a prefix of the display name. |
String |
getDisplayTo()
Gets a list of the display names of the primary (To) message recipients, separated by semicolons (;). |
long |
getFlags()
Gets the message flags. |
HeaderCollection |
getHeaders()
Gets the transport message headers |
String |
getInternetMessageId()
Gets the message id of the message. |
String |
getMessageClass()
Gets a case-sensitive string that identifies the sender-defined message class, such as IPM.Note. |
MapiPropertyCollection |
getNamedProperties()
Gets the named properties of message. |
MapiNamedPropertyMappingStorage |
getNamedPropertyMapping()
Gets the named property mapping. |
String |
getNormalizedSubject()
Gets normalized subject of the message. |
MapiPropertyStream |
getPropertyStream()
Gets the property stream. |
MapiRecipientCollection |
getRecipients()
Gets the recipients of the message. |
String |
getReplyTo()
Gets or sets the reply to names. |
String |
getSenderAddressType()
Gets the message sender's e-mail address type. |
String |
getSenderEmailAddress()
Gets or sets the message sender's e-mail address. |
String |
getSenderName()
Gets or sets the message sender's display name. |
String |
getSentRepresentingAddressType()
Gets the address type for the messaging user represented by the sender. |
String |
getSentRepresentingEmailAddress()
Gets or sets the e-mail address for the messaging user represented by the sender. |
String |
getSentRepresentingName()
Gets or sets the display name for the messaging user represented by the sender. |
String |
getSubject()
Gets or sets the subject of the message. |
String |
getSubjectPrefix()
Gets a subject prefix that typically indicates some action on a message, such as "FW: " for forwarding. |
MapiPropertyCollection |
getSubStorages()
Gets the sub storages. |
String |
getTransportMessageHeaders()
Gets the transport-specific message envelope information. |
static boolean |
isMsgFormat(InputStream stream)
|
static boolean |
isMsgFormat(String fileName)
Determines whether the specified file has a MSG format. |
boolean |
isStoreUnicodeOk()
Determines if string properties are Unicode encoded or not. |
static MapiMessage |
loadFromTnef(InputStream stream)
|
static MapiMessage |
loadFromTnef(String fileName)
Loads message from Transport Neutral Encapsulation Format (TNEF) data structure |
static MapiAttachmentCollection |
removeAttachments(String path)
Removes all of the attachments from the specified Outlook Message files. |
void |
save(OutputStream stream)
|
void |
save(String fileName)
Saves the specified file name. |
void |
saveAsTnef(OutputStream stream)
|
void |
saveAsTnef(String fileName)
Save message in TNEF format. |
void |
setBodyContent(String content,
int contentType)
Sets the content of the body. |
void |
setBodyRtf(String value)
|
void |
setClientSubmitTime(Date value)
|
void |
setDeliveryTime(Date value)
|
void |
setMessageFlags(long flags)
Sets the message flags. |
void |
setNamedPropertyMapping(MapiNamedPropertyMappingStorage value)
Sets the named property mapping. |
void |
setProperty(long value,
long signed,
long tag)
Sets the property. |
void |
setProperty(MapiAttachment value,
long signed,
long tag)
Sets the attachment. |
void |
setProperty(MapiProperty property)
Sets the property. |
void |
setProperty(MapiProperty value,
long signed,
long tag)
Sets the property. |
void |
setProperty(MapiPropertyStream value,
long signed,
long tag)
Sets the property stream. |
void |
setProperty(MapiRecipient value,
long signed,
long tag)
Sets the recipient. |
void |
setPropertySet(MapiProperty value,
long signed,
long tag)
Sets the property set. |
void |
setReplyTo(String value)
|
void |
setSenderEmailAddress(String value)
|
void |
setSenderName(String value)
|
void |
setSentRepresentingEmailAddress(String value)
|
void |
setSentRepresentingName(String value)
|
void |
setStringPropertyValue(long tag,
String value)
Sets the string property value. |
void |
setSubject(String value)
|
IMapiMessageItem |
toMapiMessageItem()
Convert MapiMessage to IMapiMessageItem object in dependence with MessageClass. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MapiMessage()
Initializes a new instance of the MapiMessage
class.
public MapiMessage(String from, String to, String subject, String body, int format)
Initializes a new instance of the MapiMessage
class.
from
- The From address.to
- The addresses of recipients. Note, that addresses are separated by semicolon.subject
- The message subject.body
- The message body.format
- Defines whether to use Unicode or ASCII encoding for this message.
com.aspose.email.ms.System.IllegalArgumentException
- Is being thrown if address of recipient is null or empty.
com.aspose.email.ms.System.IllegalArgumentException
- Is being thrown if sender or recipient address is not in a recognized format.
com.aspose.email.ms.System.InvalidEnumArgumentException
- Is being thrown if format
parameter is not a valid enumeration member.public MapiMessage(String from, String to, String subject, String body)
Initializes a new instance of the MapiMessage
class.
from
- The From address.to
- The addresses of recipients. Note, that addresses are separated by semicolon.subject
- The message subject.body
- The message body.
com.aspose.email.ms.System.IllegalArgumentException
- throws if address of recipient is null or empty.
com.aspose.email.ms.System.IllegalArgumentException
- throws if sender or recipient address is not in a recognized format.Method Detail |
---|
public String getBodyRtf()
Gets or sets the RTF formatted message text.
Value: The string that represents message body rtf.
public void setBodyRtf(String value)
public String getBodyHtml()
Gets the BodyRtf
of the message converted to HTML, if present, otherwise an empty string.
public int getBodyType()
Gets the type of the body.
Value: The type of the body.
public String getReplyTo()
Gets or sets the reply to names.
com.aspose.email.ms.System.IllegalArgumentException
- throws if reply to address is null.
com.aspose.email.ms.System.IllegalArgumentException
- throws if reply to address is not in a recognized format.
Value: The reply to names.public void setReplyTo(String value)
public String getBody()
Gets the message text.
Value: The string that represents message body.
getBody
in interface IMapiMessageItem
public String getNormalizedSubject()
Gets normalized subject of the message.
Value: The string that represents normalized subject.
public 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.
public String getDisplayNamePrefix()
Gets a prefix of the display name.
Value: The string that represents display name prefix.
public String getDisplayName()
Gets the display name for the message.
Value: The string that represents display name.
public 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.
public 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.
public String getSenderEmailAddress()
Gets or sets the message sender's e-mail address.
ArgumentException
- throws if sender address is not in a recognized format.
Value:
The string that represents sender email address.
public void setSenderEmailAddress(String value)
public String getSenderAddressType()
Gets the message sender's e-mail address type.
Value: The string that represents sender address type.
public String getSenderName()
Gets or sets the message sender's display name.
Value: The the string that represents sender name.
public void setSenderName(String value)
public String getTransportMessageHeaders()
Gets the transport-specific message envelope information.
Value: The string that represents transport message headers.
public String getInternetMessageId()
Gets the message id of the message.
Value: The string that represents internet message id.
public String getConversationTopic()
Gets the topic of the first message in a conversation thread.
Value: The string that represens conversation topic.
public String getSentRepresentingEmailAddress()
Gets or sets the e-mail address for the messaging user represented by the sender.
com.aspose.email.ms.System.IllegalArgumentException
- throws if email address is not in a recognized format.
Value:
The string that represents sent representing email address.
public void setSentRepresentingEmailAddress(String value)
public String getSentRepresentingAddressType()
Gets the address type for the messaging user represented by the sender.
Value: The string that represents sent representing address type.
public String getSentRepresentingName()
Gets or sets the display name for the messaging user represented by the sender.
Value: The string that represents sent representing name.
public void setSentRepresentingName(String value)
public 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.
public String getSubject()
Gets or sets the subject of the message.
Value: The string that represents message subject.
getSubject
in interface IMapiMessageItem
public void setSubject(String value)
public 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.
getMessageClass
in interface IMapiMessageItem
public MapiAttachmentCollection getAttachments()
Gets the attachments in the message.
Value: The attachment collection.
public MapiPropertyStream getPropertyStream()
Gets the property stream.
Value: The property stream.
public MapiPropertyCollection getNamedProperties()
Gets the named properties of message.
Value: The collection of named properties.
public MapiRecipientCollection getRecipients()
Gets the recipients of the message.
Value: The collection of recipients.
public MapiPropertyCollection getSubStorages()
Gets the sub storages.
Value: The sub storages.
public MapiNamedPropertyMappingStorage getNamedPropertyMapping()
Gets the named property mapping.
Value: The named property mapping.
public Date getClientSubmitTime()
public void setClientSubmitTime(Date value)
public Date getDeliveryTime()
public void setDeliveryTime(Date value)
public HeaderCollection getHeaders()
Gets the transport message headers
public long getFlags()
Gets the message flags.
Value: The message flags.
public static MapiMessage fromFile(String path)
Create an instance of MapiMessage from the specified file.
path
- The name of the file to be loaded.
public static MapiMessage fromStream(InputStream stream)
public static MapiMessage fromProperties(MapiPropertyCollection properties)
Creates an instance of MapiMessage from a collection of Mapi properties.
properties
- A collection of MapiProperty.
public static MapiMessage fromMailMessage(String fileName)
Creates an instance of MapiMessage from the MailMessage.
fileName
- The file name of MailMessage.
public static MapiMessage fromMailMessage(MailMessage message)
Creates an instance of MapiMessage from the MailMessage.
message
- The MailMessage.
public static MapiMessage fromMailMessage(MailMessage message, int format)
Creates an instance of MapiMessage from the MailMessage.
message
- The MailMessage.format
- The message format.
MapiMessage
that represents Outlook message.public static MapiMessage fromMailMessage(MailMessage message, int format, boolean preserveSignature)
Creates an instance of MapiMessage from the MailMessage.
message
- The MailMessage.format
- The message format.preserveSignature
- Set to true, if signature is to be preserved.
MapiMessage
that represents Outlook message.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()); }
path
- The name of the Outlook Message file.
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");
path
- The name of the Outlook Message file.public static MapiMessage loadFromTnef(InputStream stream)
public static MapiMessage loadFromTnef(String fileName)
Loads message from Transport Neutral Encapsulation Format (TNEF) data structure
fileName
- Name of file containing message data in TNEF format
MapiMessage
com.aspose.email.ms.System.IllegalArgumentException
- fileName
is null
or empty
public static boolean isMsgFormat(String fileName)
Determines whether the specified file has a MSG format.
fileName
- Name of the file.
true
if the file is represented in MSG format; otherwise, false
.public static boolean isMsgFormat(InputStream stream)
public boolean isStoreUnicodeOk()
Determines if string properties are Unicode encoded or not.
public void setStringPropertyValue(long tag, String value)
Sets the string property value.
tag
- The property tag.value
- The property value.public void setProperty(MapiProperty property)
Sets the property.
setProperty
in class MapiPropertyContainer
property
- The property.
com.aspose.email.ms.System.IllegalArgumentException
- If property
is null.
com.aspose.email.ms.System.IllegalArgumentException
- If property data is null.
IllegalStateException
- If data type is not supported.public IMapiMessageItem toMapiMessageItem()
Convert MapiMessage to IMapiMessageItem object in dependence with MessageClass.
UnsupportedOperationException
- Thrown when MessageClass doesn't belong to IPM.Note, IPM.StickyNote,
IPM.Contact, IPM.Activity, IPM.Appointment, IPM.Schedule.meeting, IPM.Task.
public void setMessageFlags(long flags)
Sets the message flags.
flags
- The message flags.public void saveAsTnef(OutputStream stream)
public void saveAsTnef(String fileName)
Save message in TNEF format.
fileName
- Name of the file where a message will be saved to.public void save(String fileName)
Saves the specified file name.
fileName
- Name of the file.public void save(OutputStream stream)
public void setBodyContent(String content, int contentType)
Sets the content of the body.
content
- The content.contentType
- Type of the content.
com.aspose.email.ms.System.IllegalArgumentException
- throws if the specified content string is null or empty.public com.aspose.email.IMapiNode createMapiNode(String tag)
Creates the mapi node.
createMapiNode
in class MapiPropertyContainer
tag
- The property tag.
public Object deepClone()
Creates a new object that is a copy of the current instance.
deepClone
in interface com.aspose.email.ms.System.ICloneable
public void setProperty(MapiAttachment value, long signed, long tag)
Sets the attachment.
setProperty
in class MapiPropertyContainer
value
- The property value.signed
- The value, that indicates that the property is signed.tag
- The property tag.public void setProperty(MapiRecipient value, long signed, long tag)
Sets the recipient.
setProperty
in class MapiPropertyContainer
value
- The property value.signed
- The value, that indicates that the property is signed.tag
- The property tag.public void setProperty(long value, long signed, long tag)
Sets the property.
setProperty
in class MapiPropertyContainer
value
- The property value.signed
- The value, that indicates that the property is signed.tag
- The property tag.public void setPropertySet(MapiProperty value, long signed, long tag)
Sets the property set.
setPropertySet
in class MapiPropertyContainer
value
- The MapiPropery.signed
- The value, that indicates that the property is signed.tag
- The property tag.public void setProperty(MapiPropertyStream value, long signed, long tag)
Sets the property stream.
setProperty
in class MapiPropertyContainer
value
- The property stream.signed
- The value, that indicates that the property is signed.tag
- The property tag.public void setProperty(MapiProperty value, long signed, long tag)
Sets the property.
setProperty
in class MapiPropertyContainer
value
- The MapiProperty.signed
- The value, that indicates that the property is signed.tag
- The property tag.public void setNamedPropertyMapping(MapiNamedPropertyMappingStorage value)
Sets the named property mapping.
setNamedPropertyMapping
in class MapiPropertyContainer
value
- The MapiNamedPropertyMappingStorage.public void dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
dispose
in interface com.aspose.email.ms.System.IDisposable
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |