As I said in my earlier response, Explorer.SelectionChange is the event that
fits your scenario. Any good VSTO add-in sample for Outlook should show you
how to work with various event handlers in C#.
I'm not sure your complete scenario is workable, though, unless you plan to
completely replace the original message as it arrives. There's no separate
functionality for controlling what's displayed in the reading pane. Also,
users could turn on AutoPreview, which would show them some of the message
contents even before they click on a particular message. Since you already
have a server process running, maybe it should be doing the message
replacement operation.
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54
"Duke2" <(E-Mail Removed)> wrote in message
news:797FBA96-F112-4DC7-96CA-(E-Mail Removed)...
> Hi Sue,
>
> By runnig a query I meant, using the email's message ID, I'd run a DB
> query
> against the database stored in the same network and then based on the
> results, I'll decide to show the original contents or show a static
> message
> from an msg file (stored locally). I have a back end process running (on
> Exchange Server) that sniffs through all email contents and if any of them
> have some keyowrds, I want them not be show to the user and instead show a
> standard message.
>
> Thank you for directing me to the VB.NET sample. I'll attempt to rewrite
> it
> in VBA. However I have a question, if I want to do this in VB.NEt then I
> have
> to develop an Outlook add-in using VSTO I assume. Please tell me if my
> assumption is right. I prefer to write code in C# (or VB.NET) and VBA is
> my
> second choice.
>
> If I can access the message header through PropertyAccessor object, where
> should I run the script to access it? This is the most confusing part to
> me.
> As I said before I can write some macros, but don't know how to call them
> and/or link them to events.
>
> Thanks
> Duke