Change BodyFormat on reply

Add-in Express™ Support Service
That's what is more important than anything else

Change BodyFormat on reply
 
nwein




Posts: 577
Joined: 2011-03-28
I've read a few https://www.add-in-express.com/forum/read.php?FID=5&TID=5748&MID=28409#message28409 (also https://www.add-in-express.com/creating-addins-blog/2011/09/19/outlook-email-formats-programmatically/ and https://www.add-in-express.com/forum/read.php?FID=5&TID=11162) but couldn't get this to work.
In my OutlookItemEventsClass on the ProcessReply i'm doing exactly what Andrei said he's doing (BTW, not truly understand why you do objMail.Body = objMail.Body but I've tried that as well) but it doesn't seem to change the BodyFormat (i.e. mail.Bodyformat stays the same after I set it to be HTML), whether it's late or early bindings.
It would seem as if all this effort would work properly once the inspector is activated, but looking at the events chain, the Reply event is being called first and only then the Inspector is activated (makes sense).
If it helps, I'm connecting my (instance of) OutlookItemEventsClass on ExplorerSelectionChange, InspectorActivate, ExplorerActivate and removing it on ItemSend, ExplorerClose, InspectorClose and AddinBeginShutdown.
Outlook 2010, 32-bit
Posted 27 Feb, 2015 15:58:54 Top
Andrei Smolin


Add-in Express team


Posts: 18793
Joined: 2006-05-11
Hello Nir,

Do you change the BodyFormat property of the original or reply item? Do you further modify this item in ProcessReply?

As to objMail.Body = objMail.Body, I believe it was some trick specific to the Outlook version used at that time; probably, it was meant to make Outlook think that something gets changed on the email.


Andrei Smolin
Add-in Express Team Leader
Posted 02 Mar, 2015 04:57:35 Top
nwein




Posts: 577
Joined: 2011-03-28
I've tried both; changing the BodyFormat of the response object, and changing the Bodyformat of a new MailItem object casted from the response (i.e. MailItem mail = (MailItem)response), neither way worked.
I'm not modifying it further more.
Here are two variations i've tried:
public override void ProcessReply(object response, ADXCancelEventArgs e)
{
    // This doesn't work
	if (((MailItem)response).BodyFormat != OlBodyFormat.olFormatHTML)
		((MailItem)response).BodyFormat = OlBodyFormat.olFormatHTML;	
}

public override void ProcessReply(object response, ADXCancelEventArgs e)
{
    // This doesn't work either
	MailItem mail = (MailItem) response;
	if (mail.BodyFormat != OlBodyFormat.olFormatHTML)
		mail.BodyFormat = OlBodyFormat.olFormatHTML;
}
Posted 02 Mar, 2015 11:11:05 Top
Andrei Smolin


Add-in Express team


Posts: 18793
Joined: 2006-05-11
Nir,

I'd try getting the item's inspector first: mail.GetInspector. If this doesn't help, I suggest doing this in the InspectorActivate event of that inspector.


Andrei Smolin
Add-in Express Team Leader
Posted 03 Mar, 2015 09:15:27 Top
nwein




Posts: 577
Joined: 2011-03-28
Nothing seemed to have worked. I had to revert to another solution. Luckily I have a form in my inspector mail compose so I can call this code in there (it works then).
Thanks for the suggestions though.
Posted 03 Mar, 2015 18:00:24 Top
Andrei Smolin


Add-in Express team


Posts: 18793
Joined: 2006-05-11
Thank you for letting me know.


Andrei Smolin
Add-in Express Team Leader
Posted 04 Mar, 2015 02:37:02 Top