Inconsistent Behavior with null and Default Date Values for Birthday and Anniversary Fields Using Aspose Email for .NET

Dear Aspose Support Team,

I am writing to seek assistance with an issue we’ve encountered in our application, which involves exporting contact information from our database to Outlook using Aspose 24.2 Email for .NET. Our process for handling Birthday and Anniversary fields is experiencing inconsistent behavior, specifically with contacts having their Birthday field set to a default date unexpectedly.

Process Overview

  1. Data Retrieval:
    We retrieve contact information from our database, including Birthday and Anniversaryfields. The Birthday field in our database view is handled as follows:

    • If the Birthday is null or set to 1900-01-01 00:00:00.000, it is intended to be treated as null in the exported contact.

    • The Anniversary field is currently not used and is set to null.

    , NULLIF (con_birthday, ‘1900-01-01 00:00:00.000’) AS birthday --datetime
    , null AS weddingAnniversary --datetime

  2. Contact Creation: We create a new MapiContact and export it to Outlook using the CreateItem method. After creation, we perform a special update operation to explicitly set Birthday and Anniversary fields to null.

    MapiContact _c = new MapiContact();
    string sID = client.CreateItem(client.GetMailboxInfo(senderEmail).ContactsUri, _c);
    await SpecialUpdateAsposeContact(_contactItem, sID, senderEmail);

  3. Special Update Logic: In the SpecialUpdateAsposeContact method, we explicitly set the Birthday and Anniversary fields to null to ensure they are cleared in Outlook.

    con.Events.Birthday = null;
    con.Events.Anniversary = null;
    client.UpdateContact(con);

Issue Description:
The expected behavior is that the Birthday and Anniversary fields in Outlook remain unset (“None”) if it is null or 1900-01-01 00:00:00.000 in our database. However, after several exports of the same contact without changing the Birthday in the database, the Birthday field in Outlook sometimes gets set to December 30, 1899, instead of remaining unset.
This behavior is inconsistent and does not always occur, making it challenging to predict when the default date will appear in place of an expected null value.

We appreciate any insights or guidance you can provide to help us resolve this issue. Please let us know if further information or clarification is needed.

Thank you for your support.
Best regards,

Hello @argocloudsolutions,

Thanks for contacting us.
We have opened the following new investigation ticket in our internal issue tracking system to reproduce the issue and fix it.

Issue ID(s): EMAILNET-41305

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

Hi @argocloudsolutions
We assume that the problem may occur when converting dates from the local format to UTS and vice versa. In some cases, it is possible to convert dates with the result you described. See attached screenshot, I don’t think this is exactly your case, but just an idea of the cause of the problem. Unfortunately, we cannot determine exactly where the problem occurred without your code that sets and comparison dates, if you share the complete code (preferably a simple console application), we can investigate the problem deeper.
screen.jpg (231.5 KB)

Hello,
here is the console app.

When creating several times the same contact it behaves differently. Sometimes the Birthday and Anniversary fields are set to null, sometimes they are filled.

Best Regards,

OutlookContact.zip (4.3 MB)

Hi @argocloudsolutions
Thank you for update. We will investigate it.