问题
I have an application that automates email communications between my companies service desk and customers. When the application needs to reply to an existing email, i use FindItems to get the email and then i load the properties i need, then i use (CreateReply) to get the response email i need to send. The strange behavior is as follows: The email i need to reply to has a correct SentDateTime and timezone (+4 GMT) but when i create a reply from it the sent date of the "replied to email" becomes UTC which makes no sense! I am specifying the timezone when i am connecting to exchange correctly and i cant seem to find a way to specify the timezone of the created reply message.
I really hope someone knows anything about this.
Just to point out, when i use outlook to manually reply to emails, the replied to email sent date time is correct. The problem only happens when i use exchange web services.
Regards Yazeed
回答1:
This problem happens because the EWS Managed API omits sending the TimeZone headers in most requests. For the reply, forwards you do need send the timezone headers else it will set the header information to UTC. One workaround is to use the events to add the timezone header back in see http://blogs.msdn.com/b/emeamsgdev/archive/2014/04/23/ews-missing-soap-headers-when-using-the-ews-managed-api.aspx . The source for the EWS Managed API is also available now so you could also patch the GetTimeZoneRequired method and recompile the library https://github.com/OfficeDev/ews-managed-api/blob/31951f456519786e41232fa9ff6a3ab20b56cac3/Core/ServiceObjects/Items/Item.cs .
Cheers Glen
来源:https://stackoverflow.com/questions/32933203/exchange-webservices-create-reply-incorrect-sent-datetime-timezone