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
-
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 to1900-01-01 00:00:00.000
, it is intended to be treated asnull
in the exported contact. -
The
Anniversary
field is currently not used and is set tonull
.
, NULLIF (con_birthday, ‘1900-01-01 00:00:00.000’) AS birthday --datetime
, null AS weddingAnniversary --datetime -
-
Contact Creation: We create a new
MapiContact
and export it to Outlook using theCreateItem
method. After creation, we perform a special update operation to explicitly setBirthday
andAnniversary
fields tonull
.MapiContact _c = new MapiContact();
string sID = client.CreateItem(client.GetMailboxInfo(senderEmail).ContactsUri, _c);
await SpecialUpdateAsposeContact(_contactItem, sID, senderEmail); -
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,