Title: Exchange Web Services save mail as draft sets DateTimeSent
Tags: c#;exchangewebservices
Question: my C# program is creating a EmailMessage item via Exchange Web Services (EWS 2.2.0) on Exchange 2010 SP2. When I call the Save method, it shows up in the Outlook drafts folder but has DateTimeSent set to current time.
This seems incorrect to me because when I create and save an email as a draft using Outlook, the property is null.
The property is also readonly so I can't set it to null.
I've tried to set it with SetExtendedProperty but did not succeed.
Any ideas how to prevent this? My users complain that the &quot;Sent Date&quot; shows up in printed email drafts (yes I know...) which aren't sent yet.
Cheers


Here is another answer: I found a workaround that works for my case.
If i set the extended property PR_CLIENT_SUBMIT_TIME to 1st Jan of 5000 it is not shown in Outlook nor on the printout:
var msg=new EmailMessage();
const int PR_CLIENT_SUBMIT_TIME = 0x0039;
DateTime weirdDateThatSomeHowIsIgnoredByExchange = new DateTime(5000, 1, 1);
msg.SetExtendedProperty(
new ExtendedPropertyDefinition(PR_CLIENT_SUBMIT_TIME, MapiPropertyType.SystemTime),
weirdDateThatSomeHowIsIgnoredByExchange.ToUniversalTime().ToString(&quot;yyyy-MM-ddTHH:mm:ssZ&quot;));
msg.Save(folder.Id);

{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 0, 'ContentLicense': 'CC BY-SA 4.0', 'CreationDate': '2020:00:11/03/20', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<c#><exchangewebservices>', 'Title': 'Exchange Web Services save mail as draft sets DateTimeSent', 'ViewCount': 176, 'id': 64662765, 'user_AboutMe': None, 'user_AccountId': 18803545.0, 'user_DisplayName': 'MightyElk', 'user_Reputation': 31.0, 'user_Views': 7.0, 'user_id': 13713383.0}}