I am creating a small client that can automatically reply to some emails. I would like to add a special internet header to these answers.
What I tried to do was set the extended property to the received email and use the EmailMessage.Reply method.
But that will not work. I also tried using EmailMessage.CreateReply . However, it creates a ResponseMessage object that does not have a SetExtendedProperty method.
This is the corresponding piece of code:
private static readonly ExtendedPropertyDefinition _redFlag = new ExtendedPropertyDefinition(DefaultExtendedPropertySet.InternetHeaders, "X-RED", MapiPropertyType.String); private static readonly PropertySet _customHeaders = new PropertySet(BasePropertySet.FirstClassProperties, _redFlag); EmailMessage email = EmailMessage.Bind(_service, id, _customHeaders); email.SetExtendedProperty(_redFlag, "test"); email.Reply(new MessageBody(answer), false);
source share