Class PstMessageWriter
java.lang.Object
com.independentsoft.pst.PstMessageWriter
Represents a message to be created in a folder of a new PST file (write side).
-
Constructor Summary
ConstructorsConstructorDescriptionPstMessageWriter(String subject, String body) Initializes a new instance of thePstMessageWriterclass. -
Method Summary
Modifier and TypeMethodDescriptionaddAttachment(String fileName, byte[] data) Adds a file attachment and returns it.addExtendedProperty(ExtendedProperty property) Adds an extended (named) property and returns it.addRecipient(String displayName, String emailAddress) Adds a "To" recipient and returns it.Gets the attachments of this message.getBody()Gets the plain-text body.Gets the extended (named) properties of this message.Gets the message class (default "IPM.Note").Gets the recipients of this message.Gets the subject.voidSets the plain-text body.voidsetMessageClass(String messageClass) Sets the message class.voidsetProperty(int propertyTag, boolean value) Sets an arbitrary boolean property (type 0x000B).voidsetProperty(int propertyTag, byte[] value) Sets an arbitrary binary property (type 0x0102).voidsetProperty(int propertyTag, int value) Sets an arbitrary 32-bit integer property (e.g.voidsetProperty(int propertyTag, long value) Sets an arbitrary 64-bit integer property (type 0x0014).voidsetProperty(int propertyTag, String value) Sets an arbitrary string property.voidsetProperty(int propertyTag, Date value) Sets an arbitrary date/time property (type 0x0040 PtypTime), stored as a FILETIME (UTC).voidsetSubject(String subject) Sets the subject.
-
Constructor Details
-
PstMessageWriter
Initializes a new instance of thePstMessageWriterclass.- Parameters:
subject- the message subject.body- the message body (plain text).
-
-
Method Details
-
getSubject
-
setSubject
-
getBody
-
setBody
-
getMessageClass
Gets the message class (default "IPM.Note").- Returns:
- the message class.
-
setMessageClass
Sets the message class.- Parameters:
messageClass- the message class.
-
getRecipients
Gets the recipients of this message.- Returns:
- the recipients.
-
addRecipient
Adds a "To" recipient and returns it.- Parameters:
displayName- the recipient display name.emailAddress- the recipient SMTP e-mail address.- Returns:
- the created
PstRecipientWriter.
-
getAttachments
Gets the attachments of this message.- Returns:
- the attachments.
-
addAttachment
Adds a file attachment and returns it.- Parameters:
fileName- the attachment file name.data- the attachment content (currently must fit within a single block, ~7 KB).- Returns:
- the created
PstAttachmentWriter.
-
setProperty
Sets an arbitrary string property. The property tag is (propertyId << 16) | propertyType, e.g. 0x0037001F for PidTagSubject. Use a string type (0x001F Unicode, 0x001E ANSI).- Parameters:
propertyTag- the property tag.value- the string value.
-
setProperty
public void setProperty(int propertyTag, int value) Sets an arbitrary 32-bit integer property (e.g. 0x00170003 PidTagImportance).- Parameters:
propertyTag- the property tag.value- the integer value.
-
setProperty
public void setProperty(int propertyTag, long value) Sets an arbitrary 64-bit integer property (type 0x0014).- Parameters:
propertyTag- the property tag.value- the long value.
-
setProperty
public void setProperty(int propertyTag, boolean value) Sets an arbitrary boolean property (type 0x000B).- Parameters:
propertyTag- the property tag.value- the boolean value.
-
setProperty
Sets an arbitrary date/time property (type 0x0040 PtypTime), stored as a FILETIME (UTC).- Parameters:
propertyTag- the property tag.value- the date/time value.
-
setProperty
public void setProperty(int propertyTag, byte[] value) Sets an arbitrary binary property (type 0x0102).- Parameters:
propertyTag- the property tag.value- the binary value.
-
getExtendedProperties
Gets the extended (named) properties of this message. EachExtendedPropertyis identified by anExtendedPropertyId(numeric) orExtendedPropertyName(string) under a property-set GUID; the PST's name-to-id map is extended automatically when the file is written.- Returns:
- the extended properties.
-
addExtendedProperty
Adds an extended (named) property and returns it.- Parameters:
property- the extended property to add.- Returns:
- the added
ExtendedProperty.
-