I am building a small client that can automatically reply to some emails. I would like to add a custom internet header to these replies.
What I tried to do is to set the extended property to the email I receive, and use the EmailMessage.Reply
method.
But it does not work. I also tried to use the EmailMessage.CreateReply
. However, it creates a ResponseMessage
object that has no SetExtendedProperty
method.
This the relevant part of the code :
private static readonly ExtendedPropertyDefinition _redFlag = new ExtendedPropertyDefinition(DefaultExtendedPropertySet.InternetHeaders, "X-RED", MapiPropertyType.String);
private static readonly PropertySet _customHeaders = new PropertySet(BasePropertySet.FirstClassProperties, _redFlag);
/* ... some code to connect to Exchange Service ... */
EmailMessage email = EmailMessage.Bind(_service, id, _customHeaders);
email.SetExtendedProperty(_redFlag, "test");
email.Reply(new MessageBody(answer), false);