Re: Outlook Events.

Tech-Archive recommends: Speed Up your PC by fixing your registry



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


.



Relevant Pages

  • Re: VBA Macro
    ... You won't find information on much of this in the Help files because many of the items on your list are not supported. ... Not necessary when programming the content of against Outlook items. ... > 3) Get the Selection text inside of it. ... Any sample code, informative sites that go beyond Microsoft's ...
    (microsoft.public.outlook.program_vba)
  • Re: Outlook Events.
    ... There are a number of Outlook methods that also have events of the same name: ... 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. ... For sample code for the events we're talking about go to www.outlookcode.com and search on those events. ...
    (microsoft.public.office.developer.com.add_ins)
  • Re: OFFICE TEXT SELECTION
    ... Milly Staples [MVP - Outlook] ... the (insert latest virus name here) virus, all mail sent to my personal ... Even if you don't have a microphone plugged in Speech ... An unwanted selection begins at the blinking ...
    (microsoft.public.office.misc)
  • RE: How to Link Outlook items to Access OLE field
    ... Thanks, David. ... The Outlook View Control ActiveX control provides users with the ability to ... (Scroll down to the 'Selection method' topic 4/5ths of the way down) ... I've never even used the OLE field type. ...
    (microsoft.public.access.modulesdaovba)
  • Re: Get a list of all the toolbars currently displaying in Outlook
    ... ItemAdd event in the folder Junk Suspects and you would think the argument ... Then I use the Selection Collection to select that added ... Dim oeExplorer As Outlook.Explorer ... Keep your Outlook categories organized! ...
    (microsoft.public.outlook.program_vba)