if (!string.IsNullOrEmpty(tasksFields.Remindertime))
{
task.ReminderTime = DateTime.ParseExact(tasksFields.Remindertime, “ddd, dd MMM yyyy HH:mm:ss”, CultureInfo.InvariantCulture);
task.ReminderSet = true;
}
else
{
task.ReminderSet = false;
}
Task Reminder is default set to 30-12-1899 and time is set 05:30 .
I want to set none when there is no reminder .
Hello @kumarpiyush01,
We reproduced the issue with the latest Aspose.Email for .NET. Your code is correct, this is a bug on our side.
MapiTask always writes the named properties PidLidReminderTime (0x8502) and PidLidReminderSignalTime (0x8560) to the output, even when ReminderSet = false. They are written with a zero FILETIME value (1601-01-01 00:00:00 UTC) instead of being omitted. Outlook sees the properties present, converts the zero value to your local time zone and displays it — that’s your 30-12-1899 05:30 (05:30 = the IST +5:30 offset applied to 00:00 UTC).
We have logged the issue and will update you once it is resolved.
Issue ID(s): EMAILNET-41815
Thank you.
Workaround: please remove both properties before saving:
static MapiMessage StripReminder(MapiTask task)
{
var ms = new MemoryStream();
task.Save(ms, TaskSaveFormat.Msg);
ms.Position = 0;
var msg = MapiMessage.Load(ms);
foreach (var p in new List<KeyValuePair<long, MapiProperty>>(msg.NamedProperties))
{
if (p.Value is MapiNamedProperty np &&
(np.NameId == "8502" || np.NameId == "8560")) // ReminderTime / ReminderSignalTime
{
msg.RemoveProperty(p.Key);
}
}
return msg;
}