Outlook Event Firing

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

Outlook Event Firing
How to Outlook Events to Fire 
NET Consult




Posts: 1
Joined: 2004-09-03
I currently evaluating the product, I am looking at the sample Toys .NET add-in, and see the code to where the Explorer Events are wired up. I have tried doing the same with the Inspectors (only one event NewInspectors) but without success.

Should events be wired up using the something similar to the 'Public Class OlExplorer_SinkHelper' code sample, or should the native OlExplorerEvents_SinkHelper be implemented instead

If I can ensure the events will fire for the different entities (without having to get at Guids etc. through OLE/COM viewer), this product will definately be added to my solution toolkit.





Posted 03 Sep, 2004 23:19:04 Top
Sergey Grischenko


Add-in Express team


Posts: 7187
Joined: 2004-07-05
Hi, thank you for your interesting question.
But it took me quite a lot of time to think
it over. -:)


Should events be wired up using the something similar to the 'Public Class OlExplorer_SinkHelper' code sample, or should the native OlExplorerEvents_SinkHelper be implemented instead

You can't use the native implementation of public ADX interfaces. The current verson of ADX requires host application events to be handled by a developer himself. We discussed several times if we should add some components that will help developers to do this. We thought of adding to the add-in module e.g. events of Outlook.Application. But we every time we were stopped by high amount of work. We were always keeping in mind that ADX supports nine hostapps each of them having dozens of events.


If I can ensure the events will fire for the different entities (without having to get at Guids etc. through OLE/COM viewer), this product will definately be added to my solution toolkit.

I advice you to visite our web site to look at the HOWTOs section. There are some Outlook samles written in C# (Soon we will add HOWTOs written in VB, Managed C++, J# and Delphi 8). The "How to handle Outlook's SelectionChange event" sample contains the code that handles Outlook's NewInspector event. However, it is not necessary to search a GUID in the OLE/COM viewer. You can use the Outlook.InspectorsEvents interface from Outlook’s PIA to implement it in your project and to get the GUID using the following code: Guid guid = typeof(Outlook.InspectorsEvents).GUID;
You have got one more way to handle Outlook’s events. Namely, you can use the following code:

(C#)
Outlook.Inspectores inspectors = OutlookHost().Inspectors;
inspectors.NewInspector += new Outlook.InspectorsEvents_NewInspectorEventHandler(OnNewInspector);

private void OnNewInspector(Outlook.Inspector inspector)
{
// Something to do.
}

Most likely you will get an error something like this “No such interface supported”.
It is a bug that occurs when you create a interop assembly for Outlook application. You can read about this bug here: http://support.microsoft.com/?kbid=309336.
Anyway, you can feel free to choose the way to handle events of applications.
Posted 06 Sep, 2004 06:42:30 Top
Sven Heitmann




Posts: 193
Joined: 2004-08-23
sergey, is there some documentation from microsoft where all events are listed an office aplication (word, excel, outlook...) can fire?
Best regards,

Sven Heitmann
Posted 06 Sep, 2004 06:51:35 Top
Eugene Starostin


ADX Team
Add-in Express team


Posts: 430
Joined: 2004-04-05
Sven,

You can find this in Object Browser of every hostapp. But we haven't come across a complete list of these events.
Posted 06 Sep, 2004 07:18:20 Top
Sergey Grischenko


Add-in Express team


Posts: 7187
Joined: 2004-07-05
An addition you can visit this page http://msdn.microsoft.com/vstudio/office/default.aspx.
And then follow the links. -:)
Posted 06 Sep, 2004 07:24:16 Top