Java - com.aspose.network.outlook.MapiMessage - How to get Date?

Hi,

For the java version of com.aspose.network.outlook.MapiMessage - how do we get the date of the email. There does not appear to be a method to do this?

I have tried to use MapiPropertyTags to do this but these also do not appear to work. I have tried to do this with the following:

MapiPropertyCollection coll = msg.getProperties();
MapiProperty prop = coll.get(MapiPropertyTag.PR_CREATION_TIME);
if (prop != null) System.out.println("PR_CREATION_TIME "+prop.GetDate().toString());
prop = coll.get(MapiPropertyTag.PR_CLIENT_SUBMIT_TIME);
if (prop != null) System.out.println("PR_CLIENT_SUBMIT_TIME "+prop.GetDate().toString());
prop = coll.get(MapiPropertyTag.PR_DELIVER_TIME);
if (prop != null) System.out.println("PR_DELIVER_TIME "+prop.GetDate().toString());
prop = coll.get(MapiPropertyTag.PR_MESSAGE_DELIVERY_TIME);
if (prop != null) System.out.println("PR_MESSAGE_DELIVERY_TIME "+prop.GetDate().toString());
prop = coll.get(MapiPropertyTag.PR_ORIGINAL_DELIVERY_TIME);
if (prop != null) System.out.println("PR_ORIGINAL_DELIVERY_TIME "+prop.GetDate().toString());
prop = coll.get(MapiPropertyTag.PR_ORIGINAL_SUBMIT_TIME);
if (prop != null) System.out.println("PR_ORIGINAL_SUBMIT_TIME "+prop.GetDate().toString());
prop = coll.get(MapiPropertyTag.PR_RECEIPT_TIME);
if (prop != null) System.out.println("PR_RECEIPT_TIME "+prop.GetDate().toString());

However, none of these really work - PR_CREATION_TIME, PR_CLIENT_SUBMIT_TIME, PR_MESSAGE_DELIVERY_TIME all come back with a strange date some time in the past. The rest of the properties are all null.

Ultimately we are trying to pull back a consistent date field from the emails. Does anyone know how to do this?

Thanks,

James

Anyone help from the support team?

Thanks,

James

Hello,

We are doing investigation on this issue. I will get back to you ASAP.

Cheers,

Hello,

We have fixed this bug. I will send you the jar later.

Thanks

Hi,



The version that you have sent through appears to be an older version - many of the methods and functions are missing.



I am meant to be merging the altered class files with the latest version of the Aspose JAR that we already have (1.0.0.4)?



This is a bit of a messy way of doing things… the code appears to have branched.



Let us know the best plan of action.



Cheers,



James

OK - I have tried merging the jar files - it does not work.

Please send through a packaged version of the latest jar with the latest set of fixes for date.

Please make this a priority.

I am also waiting on feedback for the issues with getting the SMTP version of the email addresses (in a separate post).

Thanks,

James

Hi James,

  1. Please confirm the version by checking the “AssemblyInformationalVersion” field of the MANIFEST.MF within the jar rather than the file name. The fixed version should be “2009.02.05”.

  2. I’d make a test using the following code:

public static void main(String[] args) {
    String path = "c:\\test.msg";
    MapiMessageReader reader = new MapiMessageReader(path);
    com.aspose.network.outlook.MapiMessage msg = reader.ReadMessage();
    System.out.println("MSG. ClientSubmitTime:" + msg.ClientSubmitTime());
    MapiPropertyCollection coll = msg.getProperties();
    MapiProperty prop = coll.get(MapiPropertyTag.PR_CREATION_TIME);
    if (prop != null) System.out.println("PR_CREATION_TIME "+prop.GetDate().toString());
    prop = coll.get(MapiPropertyTag.PR_CLIENT_SUBMIT_TIME);
    if (prop != null) System.out.println("PR_CLIENT_SUBMIT_TIME "+prop.GetDate().toString());
    prop = coll.get(MapiPropertyTag.PR_DELIVER_TIME);
    if (prop != null) System.out.println("PR_DELIVER_TIME "+prop.GetDate().toString());
    prop = coll.get(MapiPropertyTag.PR_MESSAGE_DELIVERY_TIME);
    if (prop != null) System.out.println("PR_MESSAGE_DELIVERY_TIME "+prop.GetDate().toString());
    prop = coll.get(MapiPropertyTag.PR_ORIGINAL_DELIVERY_TIME);
    if (prop != null) System.out.println("PR_ORIGINAL_DELIVERY_TIME "+prop.GetDate().toString());
    prop = coll.get(MapiPropertyTag.PR_ORIGINAL_SUBMIT_TIME);
    if (prop != null) System.out.println("PR_ORIGINAL_SUBMIT_TIME "+prop.GetDate().toString());
    prop = coll.get(MapiPropertyTag.PR_RECEIPT_TIME);
    if (prop != null) System.out.println("PR_RECEIPT_TIME "+prop.GetDate().toString());
}

And the output is correct:

MSG.Get:Wed Feb 04 03:30:43 GMT+08:00 2009
PR_CREATION_TIME Tue Feb 10 06:42:53 GMT+08:00 2009
PR_CLIENT_SUBMIT_TIME Wed Feb 04 03:30:43 GMT+08:00 2009
PR_MESSAGE_DELIVERY_TIME Wed Feb 04 03:30:55 GMT+08:00 2009

I’d attached my test file(test.msg) here for reference. Could you please send your msg file to me for testing?

  1. Since it’s not a production version, the API may be changed in final release, but we will try our best to make it compatible. Please tell me what classes/functions are missing and our developers will check again.

Thanks

Hi Dean,

The file that you sent me does not contain a jar file.

However, the MANIFEST.MF does contain the correct assembly date.

If I package the code up into a JAR file - it does not contain all the methods - and appears therefore to be an old version.

Please can you send me a correctly packaged version with the latest fix.

Thanks,

James

Hello,

Any update on this? Been a couple of days…

Cheers,

James

I will send you a new version with the update of getEmailAddress tomorrow.

Thanks