A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook - Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Capturing Outlook Forms Events



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old August 28th 09, 12:56 AM posted to microsoft.public.outlook.program_forms
Duke2
external usenet poster
 
Posts: 13
Default Capturing Outlook Forms Events

Hi,

I'm new to Outlook forms programing, so this quesiotn may sound silly to you
guys. Please bear with me, if so.

I'm trying to retrieve the message ID when a user clicks on a message on
Outlook 2007 and run a script (a macro?) and thereby do some checks and if
the check qualifies the message for a certain condition replace the mesage
with a standard message that's stored locally as an .msg file.

I know how to call a macro but don't know how to link a macro to an event.
Also I don't know how to parse an msg file into IPM.Note form.

Could you help me by giving me some tips, pointing to some reference
matirals online and/or offline (books). I know these are very basic
operations in Outlook programming, but I'm clueless.

Thanks
--
Duke
Ads
  #2  
Old August 28th 09, 01:36 AM posted to microsoft.public.outlook.program_forms
Sue Mosher [MVP][_3_]
external usenet poster
 
Posts: 465
Default Capturing Outlook Forms Events

Are you asking what event fires when the user clicks on an item in a folder
window? That has nothing to do with Outlook custom forms. The relevant event
is Explorer.SelectionChange event.

What do you mean by "message ID"? By "replace the message," do you mean
replace the entire Outlook message item? Or replace the message body?

To bring an .msg file into Outlook, use the Namespace.OpenSharedItem method.

The book and web site mentioned in my signature supplement the basic
information available in VBA Help.

--
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" wrote in message
...
Hi,

I'm new to Outlook forms programing, so this quesiotn may sound silly to
you
guys. Please bear with me, if so.

I'm trying to retrieve the message ID when a user clicks on a message on
Outlook 2007 and run a script (a macro?) and thereby do some checks and if
the check qualifies the message for a certain condition replace the mesage
with a standard message that's stored locally as an .msg file.

I know how to call a macro but don't know how to link a macro to an event.
Also I don't know how to parse an msg file into IPM.Note form.

Could you help me by giving me some tips, pointing to some reference
matirals online and/or offline (books). I know these are very basic
operations in Outlook programming, but I'm clueless.

Thanks
--
Duke



  #3  
Old August 28th 09, 01:51 AM posted to microsoft.public.outlook.program_forms
Duke2
external usenet poster
 
Posts: 13
Default Capturing Outlook Forms Events

Hi Sue,

Thanks for the quick response. I just bought your book "Outlook 2007
Programming" and just started learning Outlook programming.

I'm asking what event fires when the user clicks on an Outlook item, mainly
what events fire when user selects a message by clicking on an item on
Outlook main window. I didnt mean to say what events get fired on Windows
folder level.

I want to capture the unique ID of the message available in the header
called message_ID and then run a query against this message and see if it
qualifies for my special handling. If it does then I want to replace the
entire message with a stathc message that's stored locally in an msg file.

Thanks
--
Duke

  #4  
Old August 28th 09, 02:58 AM posted to microsoft.public.outlook.program_forms
Sue Mosher [MVP][_3_]
external usenet poster
 
Posts: 465
Default Capturing Outlook Forms Events

As I said, Explorer.SelectionChange is the event that fires when the user
clicks on an item in the main Outlook window.

To access the message header, you would use the PropertyAccessor object;
there's an example at
http://msdn.microsoft.com/en-us/libr...opertyaccessor.
It's VB.NET, but the basic approach would be similar in VBA, if that's what
you're writing code for.

What does "run a query against this message" mean in your scenario?
--
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" wrote in message
...
Hi Sue,

Thanks for the quick response. I just bought your book "Outlook 2007
Programming" and just started learning Outlook programming.

I'm asking what event fires when the user clicks on an Outlook item,
mainly
what events fire when user selects a message by clicking on an item on
Outlook main window. I didnt mean to say what events get fired on Windows
folder level.

I want to capture the unique ID of the message available in the header
called message_ID and then run a query against this message and see if it
qualifies for my special handling. If it does then I want to replace the
entire message with a stathc message that's stored locally in an msg file.

Thanks
--
Duke



  #5  
Old August 28th 09, 05:53 PM posted to microsoft.public.outlook.program_forms
Duke2
external usenet poster
 
Posts: 13
Default Capturing Outlook Forms Events

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
  #6  
Old August 28th 09, 06:06 PM posted to microsoft.public.outlook.program_forms
Sue Mosher [MVP][_3_]
external usenet poster
 
Posts: 465
Default Capturing Outlook Forms Events

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" wrote in message
...
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



  #7  
Old August 28th 09, 06:21 PM posted to microsoft.public.outlook.program_forms
Duke2
external usenet poster
 
Posts: 13
Default Capturing Outlook Forms Events

Thank you for the reply. In my case though I can not use VSTO but should
stick to macros as I'm not allowed to install anything on client's machines.
I hope this is something that can be done in Outlook 2007.

Yes, my intention is to replace the whole message and not just few fields
like body, subject. However if I do this in the back-end, the replacement
will be permanent I assume. That's also something that's not allowed. I have
to preserve the original message and at the same time display a different
message to the user. If I can replace the complete message as it arrives, my
goal is achieved.
  #8  
Old August 28th 09, 06:41 PM posted to microsoft.public.outlook.program_forms
Sue Mosher [MVP][_3_]
external usenet poster
 
Posts: 465
Default Capturing Outlook Forms Events

Before you go down that road, you should be aware that there's no simple way
to distribute VBA code to other users; see
http://www.outlookcode.com/article.aspx?id=28 Also, users can delete VBA
code easily. How are you planning to avoid that?

I have
to preserve the original message and at the same time display a different
message to the user. If I can replace the complete message as it arrives,
my
goal is achieved.


And do what with the original message? Also, if this is an Exchange
environment, wouldn't the user be able to see the full message with OWA?
--
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" wrote in message
...
Thank you for the reply. In my case though I can not use VSTO but should
stick to macros as I'm not allowed to install anything on client's
machines.
I hope this is something that can be done in Outlook 2007.

Yes, my intention is to replace the whole message and not just few fields
like body, subject. However if I do this in the back-end, the replacement
will be permanent I assume. That's also something that's not allowed. I
have
to preserve the original message and at the same time display a different
message to the user. If I can replace the complete message as it arrives,
my
goal is achieved.



  #9  
Old August 28th 09, 07:27 PM posted to microsoft.public.outlook.program_forms
Duke2
external usenet poster
 
Posts: 13
Default Capturing Outlook Forms Events

I thought by publishing into Organizational Forms Library, I can easily
distribute these macros to the users. But after looking at your post, I'm bit
worried.

my intention is not to show the message's original contents if it qualifies
my criteria (as I described before). I've also modified OWA premium pages to
do the same thing. OWA part is prety much complete, but it appears that
without installing anything on client's machine, I wont be able to do the
same thing with Outlook.

If we forget the distribution difficulty for a minute and think this only
needs to work on a single Outlook instance, how can I capture the events and
call a macro? Can you show me an example of this?

Thanks
Duke




  #10  
Old August 28th 09, 07:34 PM posted to microsoft.public.outlook.program_forms
Sue Mosher [MVP][_3_]
external usenet poster
 
Posts: 465
Default Capturing Outlook Forms Events

Forms published to the Organizational Forms library run VBScript code, not
VBA code, and would not provide a solution for your scenario.

These articles on Outlook events include VBA code samples and are also
available in VBA Help on your machine:

http://msdn.microsoft.com/en-us/library/bb147654.aspx -
Explorer.SelectionChange
http://msdn.microsoft.com/en-us/library/bb147644.aspx -
Inspectors.NewInspector

Still looking for an answer to my question about what you plan to do with
the original message's content if you replace all the fields with data from
some other source.
--
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" wrote in message
...
I thought by publishing into Organizational Forms Library, I can easily
distribute these macros to the users. But after looking at your post, I'm
bit
worried.

my intention is not to show the message's original contents if it
qualifies
my criteria (as I described before). I've also modified OWA premium pages
to
do the same thing. OWA part is prety much complete, but it appears that
without installing anything on client's machine, I wont be able to do the
same thing with Outlook.

If we forget the distribution difficulty for a minute and think this only
needs to work on a single Outlook instance, how can I capture the events
and
call a macro? Can you show me an example of this?

Thanks
Duke






 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Capturing Send/Receive events in VSTO add-in Aakash Polra Outlook - General Queries 1 September 30th 08 05:49 PM
Capturing user Keypress in Outlook VBA Praveen Mishra Outlook and VBA 3 April 1st 08 01:42 PM
Capturing OE 6.0 Message Steve[_2_] Outlook Express 1 August 7th 07 12:01 PM
Control events in Outlook 2007 custom forms/regions nalpakj Outlook - Using Forms 1 January 10th 07 02:17 PM
Control events in Outlook 2007 custom forms/regions nalpakj Outlook - Using Forms 1 January 9th 07 11:08 PM


All times are GMT +1. The time now is 07:13 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.