MapiTask with no due date in PST translates to a due date in the year 4041

If a MapiTask is created with no due date, for example, if the task is a recurring task with no end date, and added to a PST, once it it opened in Outlook, it has a date with the year 4041.

Is this a bug?

@pguerzenichsmall,
Thank you for the issue description. Could you please share a code example, the PST file and screenshots demonstrating the problem? Also, please share a screenshot of the Appointment Recurrence window from Outlook for that MapiTask.

office365_exchange-export-1615558146523.pst.zip (2.0 MB)
Screen Shot 2021-03-12 at 9.13.25 AM.png (29.4 KB)
Screen Shot 2021-03-12 at 9.15.19 AM.png (21.4 KB)

I have a correction to my original post. The due date IS being set.

The code is fairly simple. We are using the java library in a scala app:

  val mapiTask = new MapiTask
  mapiTask.setSubject(fullTask.task.subject.getOrElse(""))
  mapiTask.setCategories(fullTask.categories.map(c => c.value).toArray)
  mapiTask.setPercentComplete(fullTask.percentComplete)
  mapiTask.setActualEffort(fullTask.actualWork)
  mapiTask.setEstimatedEffort(fullTask.totalWork)
  mapiTask.setCompanies(fullTask.companies.map(c => c.value).toArray)

  fullTask.lastModifiedTime.foreach(d => mapiTask.setLastUpdate(new Date(d.getMillis)))
  fullTask.dueDate.foreach(d => mapiTask.setDueDate(new Date(d.getMillis)))
  fullTask.startDate.foreach(d => mapiTask.setStartDate(new Date(d.getMillis)))
  fullTask.completeDate.foreach(d => mapiTask.setDateCompleted(new Date(d.getMillis)))

In the case of the PST file generated above, the above values are set to:
due date: 2021-04-11T04:00:00.000Z
completion date: Not set
startDate: Not set
lastUpdate: 2021-03-11T15:54:22.000Z

And for the recurrence pattern:
Monthly
dayOfMonth: 11
period: 1
startDate: 2021-03-11Z

@pguerzenichsmall,
To my regret, I cannot check your code example containing an unknown symbol fullTask. Could you please share a comprehensive code example in Java for investigating the problem?

Please try this:

import org.joda.time.format.DateTime
import org.joda.time.format.DateTimeFormat

 DateTimeFormat dateFormat = DateTimeFormat.forPattern("yyyy-MM-ddZ")

MapiTask mapiTask = new MapiTask()
mapiTask.setSubject("A Monthly Task With an Attachment")
mapiTask.setPercentComplete(100)
mapiTask.setActualEffort(170)
mapiTask.setEstimatedEffort(720)

mapiTask.setLastUpdate(DateTime.parse("2021-03-11T15:54:22.000Z"))
mapiTask.setDueDate(DateTime.parse("2021-04-11T04:00:00.000Z"))

MapiCalendarMonthlyRecurrencePattern ret = new MapiCalendarMonthlyRecurrencePattern();
ret.setPatternType(MapiCalendarRecurrencePatternType.Month)
ret.setEndType(MapiCalendarRecurrenceEndType.NeverEnd)
ret.setDayofMonth(11)
ret.setPeriod(1)
ret.setStartDate(dateFormat.parseLocalDate("2021-03-11Z").toDate)

@pguerzenichsmall,
Thank you for the code example. It will take me a while to investigate the issue. I will keep you informed about any progress.

@pguerzenichsmall,
To my regret, I cannot check your code example containing unknown methods. Please share a simple standalone Java project to further investigation.