Contextualize on mail content

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

Contextualize on mail content
 
Bert Sinnema


Guest


Hi,

We run an add-in that messes a little with the HTMLBody of an email. When i select an email "Read" in let's say Sent items either in Explorer or Inspector, I want to show a form. For the emails I didn't do that I dont want to show it.

What would be a best practice here? I thought about a custom MessageClass, but I'm not sure how easy it is to have a custom message class and have it fully inherit the MailRead UI. Another option to base it on the content of the email but this seems a bit dirty.

Any ideas?
Posted 18 Aug, 2015 12:35:18 Top
nwein




Posts: 577
Joined: 2011-03-28
Sounds like custom/user property solution to me.
You create a user property for the items you mess with and then, when the item contains that property, you show your form; conversely, you hide your form for items without that property.
Have a look at https://msdn.microsoft.com/en-us/library/microsoft.office.interop.outlook.userproperty.aspx
Posted 18 Aug, 2015 14:22:36 Top
Bert Sinnema


Guest


Ah yeah, that would do the trick although i can't contextualize this in the FormsManager. I should do this in an BeforeShow event of some kind right?

And, how would i do this for incoming email. Is there an event where i can process an incoming email? I want to scan this email for content and give it some properties as well.
Posted 19 Aug, 2015 05:19:28 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Hi Bert,

Does the solution suggested by Nir suit you?
Posted 19 Aug, 2015 05:19:39 Top
Bert Sinnema


Guest


What would you propose Dmitry? can i contextualize forms in a formsmanager with a UserProperty?
Posted 19 Aug, 2015 05:24:28 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Hi Bert,

I should do this in an BeforeShow event of some kind right?


Yes, you can use the ADXBeforeFormShow event handler.

And, how would i do this for incoming email. Is there an event where i can process an incoming email? I want to scan this email for content and give it some properties as well.


The Outlook Object Model provides the NewMail, NewMailEx and ItemAdd events that you can use. Please have a look at the series of https://www.add-in-express.com/creating-addins-blog/author/pieter-van-der-westhuizen/ articles about handling incoming emails:
https://www.add-in-express.com/creating-addins-blog/2011/10/03/outlook-newmail-event/

Note, there are 4 articles in the series.
Posted 19 Aug, 2015 05:35:45 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Hi Bert,

What would you propose Dmitry? can i contextualize forms in a formsmanager with a UserProperty?


You can use the ADXBeforeFormShow event and handle the UserProperty in the code.
Posted 19 Aug, 2015 05:42:51 Top