Not able Load the creation date and last modification date of msg file

Hello

The Aspose.Email.dll v17.6 are not able to load the creation date and last modification date of embeded attachment of msg file. If you want we can share the sample.

Thanks and Regards
Shital diwate

@Shital_diwate,

Thank you for posting your inquiry.

Please share your sample input file and code with us that you are using at your end. If this used to work with a previous version of the API, please share that as well with us for regression testing at our end. We’ll look into these for assisting you further.

Hello

For input file and code please refer the link below
[http://downloads.systoolsgroup.com/installer/Aspose.zip ](http://downloads.systoolsgroup.com/installer/Aspose.zip)

Thanks and regards
Shital diwate

@Shital_diwate,

We couldn’t find any code sample in your shared project. However, we have tested the issue at our end with the following sample code and it displays both timings for Creation and Last Modification times.

Sample Code

MapiMessage msg = MapiMessage.FromFile("100800\\EML and MSG attachments.msg");

MapiAttachment att = msg.Attachments[0];

if (att.ObjectData.IsOutlookMessage)
{
    MemoryStream ms = new MemoryStream();

    att.Save(ms);

    ms.Position = 0;

    MapiMessage attMsg = MapiMessage.FromStream(ms);

    Console.WriteLine(attMsg.Properties[MapiPropertyTag.PR_CREATION_TIME]);

    Console.WriteLine(attMsg.Properties[MapiPropertyTag.PR_LAST_MODIFICATION_TIME]);
}

msg.Dispose();

Hello

We have used your given sample code, yes its working but it is giving the last modification date and creation of MSG as mail (last modification and creation of mail) not of MSG file properties date. We are looking for the attachment as file properties date.

Thanks and regards
Shital diwate

@Shital_diwate,

If you open this source message in Outlook and drag these attachment messages to disk, you will see that windows automatically sets the Date Created and Date Modified to the current system time. Same will be the result if we fetch these messages using Aspose.Email for .NET and save attachments on disc. Using above mentioned sample code, Aspose provides you the actual time values which are stored in attachment properties (without modifying them similar to Windows). Hence I am afraid that no other dates are available in the file which can be retrieved. If you are able to fetch any original attachment files creation and modification dates by any method, please share the steps with us. We will try to provide same functionality using Aspose.Email.

Okay. Thank you for your quick reply!

My thought was if I have the document e.g. the MSG file created let’s say in 2015 on my disk and if I attach it to any mail and send it to some one in year 2017. Now if I create the MSG file of this mail ( which is having the attachment of 2015 MSG and sent in 2017
so according to me the MSG attachments created date should be of 2015 not of the current one.
Aspo is showing this date & time.jpg (63.6 KB)

@Shital_diwate,

You may please use following sample code to display the attachment file creation and modification date irrespective of its type. Please give it a try and share the feedback.

MapiMessage msg = MapiMessage.FromFile(@"EML and MSG attachments.msg");
foreach (MapiAttachment att in msg.Attachments)
{
    Console.WriteLine(att.Properties[MapiPropertyTag.PR_CREATION_TIME]);
    Console.WriteLine(att.Properties[MapiPropertyTag.PR_LAST_MODIFICATION_TIME]);
}