I have an addin that synchronized the contacts folder with an outside source. The Sync happens daily (or manually on demand) and takes a while. Users have asked for the addin to provide information about the sync so that they know it completed successfully, etc.
Since the Outlook API doesn't provide a way to add information to the status bar (i.e. details about the sync as it is happening), I would like to create a log file automatically each sync (and stick it in the Deleted Items folder so that it is out of the way).
When I tried to create a message and .Move() it to the deleted items folder, it appeared there, but without a Received time and so was sorted to the end of the list and hard to find. Also, it looks to the user like an unsent message (a draft).
Is there a way to create a message and have the Received time be set to approx the time the message was created (the property is read-only)?
NameSpace mapi = _outlook.GetNamespace("MAPI");
MAPIFolder deletedItems = mapi.GetDefaultFolder(OlDefaultFolders.olFolderDeletedItems);
MailItem message = (MailItem)_outlook.CreateItem(OlItemType.olMailItem);
message.Subject = "Contact Sync Errors";
message.BodyFormat = OlBodyFormat.olFormatPlain;
message.Body = "This is my log message";
message.Move(deletedItems);