Re: Outlook Events.
- From: JIGNESH <JIGNESH@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 14 Apr 2009 10:23:01 -0700
Fantastic. Thanks Ken... This information is quit helpful.
I believe "ActiveExplorer" will solve my missing links.
Regards
JIGNESH
"Ken Slovak - [MVP - Outlook]" wrote:
There are a number of Outlook methods that also have events of the same.
name: Send, Close, Forward, Reply, etc. That doesn't mean the events don't
exist.
In those cases, especially with C#, you must use one of the special events
references such as the InspectorEvents_Event selection. For an Inspector
here's how I'd set up that event handler using C#:
((Outlook.InspectorEvents_Event)_insp).Close +=
new Outlook.InspectorEvents_CloseEventHandler(InspClose);
In that line "_insp" is a class level Inspector object and "InspClose" is
the handler procedure. "Outlook" is an alias established using this line at
the class level:
using Outlook=Microsoft.Office.Interop.Outlook;
When an item is opened it fires NewInspector() and the Inspector events will
then be available (assuming you handle them). The item events are also then
available for handling.
When an item is viewed in a folder view in the reading pane it does fire the
item.Read() event, but you need a handle to the item to be able to sink that
event. In that case you look to the Explorer, specifically the
ActiveExplorer() object. You handle the SelectionChange() event on the
Explorer and as the Selection collection changes you can set up to handle
item events for every item in the Selection collection.
You usually also handle the Explorer.BeforeFolderSwitch() event so you know
if the folder being switched to is one where you want to handle events.
One tip, Outlook collections, like many COM collections, start at index ==
1. So don't start iterating a collection like Selection at index 0, it's
invalid.
For sample code for the events we're talking about go to www.outlookcode.com
and search on those events. There's lots of sample code there for those and
other things in both C# and VB.NET.
--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm
"JIGNESH" <JIGNESH@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:969B6B47-84CC-4E0C-9C5C-4A75652273A3@xxxxxxxxxxxxxxxx
Hi Ken,
Thanks for your inputs.
When you double click any email item, it opens in new window, else on one
click, it opens mail in the right had side section , next to mail list.
What I am looking for is that when i scroll through the mail list it
should
give me some events like load/unload or GotFocus/LostFocus.
Any sample code on these lines?
Given your inputs on item.Close() and Inspector.Close() events, I tried,
but
they do not get triggered. More over I found Inspector.Close() is a method
and not a event.
Regards
- References:
- Outlook Events.
- From: JIGNESH
- Re: Outlook Events.
- From: Ken Slovak - [MVP - Outlook]
- Re: Outlook Events.
- From: JIGNESH
- Re: Outlook Events.
- From: Ken Slovak - [MVP - Outlook]
- Outlook Events.
- Prev by Date: Re: Snoozed occurrence doesn't generate exception
- Next by Date: Create Bitmap image from Outlook Category colour
- Previous by thread: Re: Outlook Events.
- Next by thread: Snoozed occurrence doesn't generate exception
- Index(es):
Relevant Pages
|