I am creating Journal entries dynamically and saving them into an Outlook PST file using Aspose.Email for .NET.
I need to populate the Duration field for these journal items based on incoming string timestamps. However, the MapiJournal.Duration property is completely read-only, meaning it cannot be set directly via code.
When I parse my start and end times and write the items to a PST folder via AddMapiMessageItem, Outlook renders the duration field as a massive negative number (specifically -3582899 hours).
Hello @kumarpiyush01,
Thanks for the details.
MapiJournal.Duration is a derived value. It is calculated as EndTime − StartTime.
Don’t try to set Duration directly (it’s read-only by design). Instead, make sure both StartTime and EndTime are assigned and that EndTime is not earlier than StartTime:
var journal = new MapiJournal(subject, body, description, briefDescription);
journal.StartTime = DateTime.Parse(incomingStart);
journal.EndTime = DateTime.Parse(incomingEnd); // required — otherwise it stays at 1601-01-01
// journal.Duration is now computed automatically = EndTime - StartTime
With both times set correctly, the journal item writes PidLidLogDuration and Outlook displays the correct duration.
Please give this a try and let us know if the duration still looks wrong.