Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.poi.hsmf
Class MAPIMessage

    java.lang.Object
      org.apache.poi.POIDocument
          org.apache.poi.hsmf.MAPIMessage

    public class MAPIMessage

extends org.apache.poi.POIDocument

Reads an Outlook MSG File in and provides hooks into its data structure. If you want to develop with HSMF, you might find it worth getting some of the microsoft public documentation, such as: [MS-OXCMSG]: Message and Attachment Object Protocol Specification

Constructor Summary
`MAPIMessage()` Constructor for creating new files.
`MAPIMessage(org.apache.poi.poifs.filesystem.DirectoryNode poifsDir, org.apache.poi.poifs.filesystem.POIFSFileSystem fs)` Constructor for reading MSG Files from a certain point within a POIFS filesystem
`MAPIMessage(java.io.InputStream in)` Constructor for reading MSG Files from an input stream.
`MAPIMessage(org.apache.poi.poifs.filesystem.POIFSFileSystem fs)` Constructor for reading MSG Files from a POIFS filesystem
`MAPIMessage(java.lang.String filename)` Constructor for reading MSG Files from the file system.

Method Summary
`AttachmentChunks[]` | `getAttachmentFiles()` Gets the message attachments.
`java.lang.String` | `getConversationTopic()` Gets the conversation topic of the parsed Outlook Message.
`java.lang.String` | `getDisplayBCC()` Gets the display value of the "BCC" line of the outlook message.
`java.lang.String` | `getDisplayCC()` Gets the display value of the "CC" line of the outlook message.
`java.lang.String` | `getDisplayFrom()` Gets the display value of the "FROM" line of the outlook message This is not the actual address that was sent from but the formated display of the user name.
`java.lang.String` | `getDisplayTo()` Gets the display value of the "TO" line of the outlook message.
`java.lang.String[]` | `getHeaders()` Returns all the headers, one entry per line
`Chunks` | `getMainChunks()` Gets the main, core details chunks
`java.lang.String` | `getMessageClass()` Gets the message class of the parsed Outlook Message.
`java.util.Calendar` | `getMessageDate()` Gets the date that the message was accepted by the server on.
`NameIdChunks` | `getNameIdChunks()` Gets the Name ID chunks, or null if there aren't any
`RecipientChunks[]` | `getRecipientDetailsChunks()` Gets all the recipient details chunks.
`java.lang.String` | `getRecipientEmailAddress()` Returns all the recipients' email address, separated by semicolons.
`java.lang.String[]` | `getRecipientEmailAddressList()` Returns an array of all the recipient's email address, normally in TO then CC then BCC order.
`java.lang.String` | `getRecipientNames()` Returns all the recipients' names, separated by semicolons.
`java.lang.String[]` | `getRecipientNamesList()` Returns an array of all the recipient's names, normally in TO then CC then BCC order.
`java.lang.String` | `getStringFromChunk(StringChunk chunk)` Gets a string value based on the passed chunk.
`java.lang.String` | `getSubject()` Gets the subject line of the Outlook Message
`java.lang.String` | `getTextBody()` Gets the plain text body of this Outlook Message
`void` | `guess7BitEncoding()` Many messages store their strings as unicode, which is nice and easy.
`boolean` | `isReturnNullOnMissingChunk()` Will you get a null on a missing chunk, or a `ChunkNotFoundException` (default is the exception).
`void` | `setReturnNullOnMissingChunk(boolean returnNullOnMissingChunk)` Sets whether on asking for a missing chunk, you get back null or a `ChunkNotFoundException` (default is the exception).
`void` | `write(java.io.OutputStream out)` Note - not yet supported, sorry.

Methods inherited from class org.apache.poi.POIDocument
`createInformationProperties, getDocumentSummaryInformation, getSummaryInformation`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### MAPIMessage

    public MAPIMessage()

  Constructor for creating new files.

### MAPIMessage

    public MAPIMessage(java.lang.String filename)
                throws java.io.IOException

  Constructor for reading MSG Files from the file system.

  Parameters:
    `filename` -
  Throws:
    `java.io.IOException`

### MAPIMessage

    public MAPIMessage(java.io.InputStream in)
                throws java.io.IOException

  Constructor for reading MSG Files from an input stream.

  Parameters:
    `in` -
  Throws:
    `java.io.IOException`

### MAPIMessage

    public MAPIMessage(org.apache.poi.poifs.filesystem.POIFSFileSystem fs)
                throws java.io.IOException

  Constructor for reading MSG Files from a POIFS filesystem

  Parameters:
    `fs` -
  Throws:
    `java.io.IOException`

### MAPIMessage

    public MAPIMessage(org.apache.poi.poifs.filesystem.DirectoryNode poifsDir,
                       org.apache.poi.poifs.filesystem.POIFSFileSystem fs)
                throws java.io.IOException

  Constructor for reading MSG Files from a certain point within a POIFS filesystem

  Parameters:
    `poifsDir` -
    `fs` -
  Throws:
    `java.io.IOException`

Method Detail

### getStringFromChunk

    public java.lang.String getStringFromChunk(StringChunk chunk)
                                        throws ChunkNotFoundException

  Gets a string value based on the passed chunk.

  Throws:
    `ChunkNotFoundException` - if the chunk isn't there

### getTextBody

    public java.lang.String getTextBody()
                                 throws ChunkNotFoundException

  Gets the plain text body of this Outlook Message

  Returns:
    The string representation of the 'text' version of the body, if available.
  Throws:
    `ChunkNotFoundException`

### getSubject

    public java.lang.String getSubject()
                                throws ChunkNotFoundException

  Gets the subject line of the Outlook Message

  Throws:
    `ChunkNotFoundException`

### getDisplayFrom

    public java.lang.String getDisplayFrom()
                                    throws ChunkNotFoundException

  Gets the display value of the "FROM" line of the outlook message This is not the actual address that was sent from but the formated display of the user name.

  Throws:
    `ChunkNotFoundException`

### getDisplayTo

    public java.lang.String getDisplayTo()
                                  throws ChunkNotFoundException

  Gets the display value of the "TO" line of the outlook message. If there are multiple recipients, they will be separated by semicolons. This is not the actual list of addresses/values that will be sent to if you click Reply in the email - those are stored in `RecipientChunks`.

  Throws:
    `ChunkNotFoundException`

### getDisplayCC

    public java.lang.String getDisplayCC()
                                  throws ChunkNotFoundException

  Gets the display value of the "CC" line of the outlook message. If there are multiple recipients, they will be separated by semicolons. This is not the actual list of addresses/values that will be sent to if you click Reply in the email - those are stored in `RecipientChunks`.

  Throws:
    `ChunkNotFoundException`

### getDisplayBCC

    public java.lang.String getDisplayBCC()
                                   throws ChunkNotFoundException

  Gets the display value of the "BCC" line of the outlook message. If there are multiple recipients, they will be separated by semicolons. This is not the actual list of addresses/values that will be sent to if you click Reply in the email - those are stored in `RecipientChunks`. This will only be present in sent emails, not received ones!

  Throws:
    `ChunkNotFoundException`

### getRecipientEmailAddress

    public java.lang.String getRecipientEmailAddress()
                                              throws ChunkNotFoundException

  Returns all the recipients' email address, separated by semicolons. Checks all the likely chunks in search of the addresses.

  Throws:
    `ChunkNotFoundException`

### getRecipientEmailAddressList

    public java.lang.String[] getRecipientEmailAddressList()
                                                    throws ChunkNotFoundException

  Returns an array of all the recipient's email address, normally in TO then CC then BCC order. Checks all the likely chunks in search of the addresses.

  Throws:
    `ChunkNotFoundException`

### getRecipientNames

    public java.lang.String getRecipientNames()
                                       throws ChunkNotFoundException

  Returns all the recipients' names, separated by semicolons. Checks all the likely chunks in search of the names. See also `getDisplayTo()`, `getDisplayCC()` and `getDisplayBCC()`.

  Throws:
    `ChunkNotFoundException`

### getRecipientNamesList

    public java.lang.String[] getRecipientNamesList()
                                             throws ChunkNotFoundException

  Returns an array of all the recipient's names, normally in TO then CC then BCC order. Checks all the likely chunks in search of the names. See also `getDisplayTo()`, `getDisplayCC()` and `getDisplayBCC()`.

  Throws:
    `ChunkNotFoundException`

### guess7BitEncoding

    public void guess7BitEncoding()

  Many messages store their strings as unicode, which is nice and easy. Some use one-byte encodings for their strings, but don't easily store the encoding anywhere in the file! This method looks at the headers for the message, and tries to use these to guess the correct encoding for your file. Bug #49441 has more on why this is needed

### getHeaders

    public java.lang.String[] getHeaders()
                                  throws ChunkNotFoundException

  Returns all the headers, one entry per line

  Throws:
    `ChunkNotFoundException`

### getConversationTopic

    public java.lang.String getConversationTopic()
                                          throws ChunkNotFoundException

  Gets the conversation topic of the parsed Outlook Message. This is the part of the subject line that is after the RE: and FWD:

  Throws:
    `ChunkNotFoundException`

### getMessageClass

    public java.lang.String getMessageClass()
                                     throws ChunkNotFoundException

  Gets the message class of the parsed Outlook Message. (Yes, you can use this to determine if a message is a calendar item, note, or actual outlook Message) For emails the class will be IPM.Note

  Throws:
    `ChunkNotFoundException`

### getMessageDate

    public java.util.Calendar getMessageDate()
                                      throws ChunkNotFoundException

  Gets the date that the message was accepted by the server on.

  Throws:
    `ChunkNotFoundException`

### getMainChunks

    public Chunks getMainChunks()

  Gets the main, core details chunks

### getRecipientDetailsChunks

    public RecipientChunks[] getRecipientDetailsChunks()

  Gets all the recipient details chunks. These will normally be in the order of: * TO recipients, in the order returned by `getDisplayTo()` * CC recipients, in the order returned by `getDisplayCC()` * BCC recipients, in the order returned by `getDisplayBCC()`

### getNameIdChunks

    public NameIdChunks getNameIdChunks()

  Gets the Name ID chunks, or null if there aren't any

### getAttachmentFiles

    public AttachmentChunks[] getAttachmentFiles()

  Gets the message attachments.

### write

    public void write(java.io.OutputStream out)
               throws java.io.IOException

  Note - not yet supported, sorry.

  Specified by:
    `write` in class `org.apache.poi.POIDocument`
  Throws:
    `java.io.IOException`

### isReturnNullOnMissingChunk

    public boolean isReturnNullOnMissingChunk()

  Will you get a null on a missing chunk, or a `ChunkNotFoundException` (default is the exception).

### setReturnNullOnMissingChunk

    public void setReturnNullOnMissingChunk(boolean returnNullOnMissingChunk)

  Sets whether on asking for a missing chunk, you get back null or a `ChunkNotFoundException` (default is the exception).

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD