0

I was digging in Apache POI API, trying out what all properties it fetches out of MSG file.

I parsed MSG file using POIFSChunkParser.

Here is the code:

try
{
    InputStream is = new     FileInputStream("C:\\path\\email.msg");
    POIFSFileSystem poifs = new POIFSFileSystem(is);
    POIFSChunkParser poifscprsr = new POIFSChunkParser();
    ChunkGroup[] chkgrps = poifscprsr.parse(poifs);
    for(ChunkGroup chunkgrp : chkgrps )
    {
        for(Chunk chunk : chunkgrp.getChunks())
        {
            System.out.println(chunk.getEntryName() + " ("
                    + chunk.getChunkId() + ") " + chunk);
        }
    }           
}
catch(FileNotFoundException fnfe)
{
    System.out.println(fnfe.getMessage());
}
catch(IOException ioe)
{
    System.out.println(ioe.getMessage());
}

In output it listed all accessible properties of MSG. One of them was looking like this:

__substg1.0_800A001F (32778) 04

I tried to find what is the significance of the property with HEX 800A here. (The subnodes of this topic lists the properties.)

Q1. However I didnt find property corresponding to HEX 800A. So what should I infer?

Also, I have some other but somewhat related questions:

Q2. Does Apache POI exposes all properties through MAPIMessage (I tried out exploring all methods of MAPIMessage too and started thinking it does not)?

Q3. If not, is there any other way to access all MAPI properties in Java with or without Apache POI.

Anthony Raymond
  • 7,434
  • 6
  • 42
  • 59
Mahesha999
  • 22,693
  • 29
  • 116
  • 189

1 Answers1

0

First up, be a little wary of using the very low level HSMF classes if you're not following the Apache POI Dev List. There have been some updates to HSMF fairly recently to start adding support for fixed-length properties, and more are needed. Generally the high level classes will have a pretty stable API (even with the scratchpad warnings), which the lower level ones can (and sometimes do) change as new support gets added. If you're not on the dev list, this might be a shock...

Next up - working out what stuff is. This is where the HSMF Dev Tools come in. The simple TypesLister will let you check all the types that POI knows about (slightly more than it supports), while HSMFDump will do it's best to decode the file for you. If your chunk is of any kind of known type, between those two you can hopefully work out what it is and what it contains

Finally - getting all properties. As alluded to above, Apache POI used to only support variable length properties in .msg files. That has partly been corrected, with some fixed length support in there too, but more work is needed. Volunteers welcomed on the Dev List! MAPIMessage will give you all the common bits, but will also give you access to the different Chunk Groups. (A given message will be spread across a few different chunks, such as the main one, recipient ones, attachment ones etc). From there, you can get all the properties, along with the PropertiesChunk which gives access to the fixed length properties.

Gagravarr
  • 47,320
  • 10
  • 111
  • 156