outlook newmail event for different version causing problems

  • Thread starter kedar_vj via OfficeKB.com
  • Start date
K

kedar_vj via OfficeKB.com

I have handled new mail events for OL XP. but while installing in OL2003 its
giving error
"could not load type outlook.applicationevents_11_ newemaileventHandler from
asembly interop.outlook " >> OBVIOUSLY its version difference <<
but is there any way out to handle/get such event which can handle new mail
event in all outlook versions?
Any workarounds to capture all versions newemaileventhandler !!!??
please reply, is it possible to do that?

I have tried with addin
outlook 2003(11 object lib (v. 9.2)) >> works in OL2003 only
outlook 2002(10 object lib (v. 9.1)) >> works in OL2002(XP) only
and again OL2000 is having annoying different "FEATURES" to work with.
I don't understand how to do that thing work !!

I have seen OutlookSpy >> "an addin" works with any outlook !! So
there must not be different code for each outlook !
(though not at my scenario of new mail but still it works)
Then my add-in should work too.

the error i am getting is:
"system.runtime.interopservices.comexception(0x80040200.........
at outlook.applicationevents_11_EventProvider.init()...
.................................."


this occurs when i try to get the applicationObject in to a variable.
outapp = ApplicationObject

outapp object is responsible to handle the new-email-events and hence
i must have to declare it
WITHEVENTS outapp as outlook.application

this is where problem lies !!
outlook.application is Ref. to OL2003
applicationObject is of OL-2002(XP)
so is there any way out to get out of this !!
 
K

Ken Slovak - [MVP - Outlook]

OutlookSpy works directly with Extended MAPI, it has nothing to do with
PIA's or .NET. In COM coding you don't have those 10, 11 or 12 events. You
just have events that are or aren't present in a specific version of
Outlook.

Extended MAPI can only be used generally from C++ or Delphi and is not
supported at all for .NET use.

The Outlook 2003 PIA's are not installed by default, you must explicitly
install them or have your application install them.

In general, if you are targeting multiple versions of Outlook you use only
those events present in the earliest version you intend to support. Using
ApplicationEvents_11_NewMailEventHandler would only work for Outlook 2003.
Using ApplicationEvents_10_NewMailEventHandler would only work for Outlook
2002.

For use in those situations you can fall back to the usage that would work
in Outlook 2000, 2002 and 2003 (and 2007), since NewMail exists in Outlook
2000 and later. Use ApplicationEvents_NewMailEventHandler.

Learn to make use of the Object Browser, which shows all methods and
properties and events that are available to you.
 
K

kedar_vj via OfficeKB.com

thank you ken for reply.
but there is a problem with this NewMailEventhandler only.
I'm NOT using ApplicationEvents_10_NewMailEventHandler to handle new mail
event.
i am using application event's NewMailEventHandler.
but this too generates the error.

Private Sub outApp_NewMail() Handles outApp.NewMail
[where outapp is outlook object of perticular outlook PIA. OL 2k,2k3...
]
as internally this must be using the "_11_Newmailevent"
and hence this has been a big problem for me to code !

OutlookSpy works directly with Extended MAPI, it has nothing to do with
PIA's or .NET. In COM coding you don't have those 10, 11 or 12 events. You
just have events that are or aren't present in a specific version of
Outlook.

Extended MAPI can only be used generally from C++ or Delphi and is not
supported at all for .NET use.

The Outlook 2003 PIA's are not installed by default, you must explicitly
install them or have your application install them.

In general, if you are targeting multiple versions of Outlook you use only
those events present in the earliest version you intend to support. Using
ApplicationEvents_11_NewMailEventHandler would only work for Outlook 2003.
Using ApplicationEvents_10_NewMailEventHandler would only work for Outlook
2002.

For use in those situations you can fall back to the usage that would work
in Outlook 2000, 2002 and 2003 (and 2007), since NewMail exists in Outlook
2000 and later. Use ApplicationEvents_NewMailEventHandler.

Learn to make use of the Object Browser, which shows all methods and
properties and events that are available to you.
I have handled new mail events for OL XP. but while installing in OL2003
its
[quoted text clipped - 35 lines]
applicationObject is of OL-2002(XP)
so is there any way out to get out of this !!
 
K

Ken Slovak - [MVP - Outlook]

Normally you develop on a machine with the lowest version of Outlook
installed that you intend to support, then you just reference the PIA for
that version of Outlook. Outlook 2000 is a special case because it doesn't
have a PIA and you must specially modify the Outlook 2002 PIA.

You can also install multiple versions of a PIA, for example the Outlook 10
and 11 PIA's, on one development machine. In your case you should have both
PIA's installed and set your Outlook reference to the Outlook 10 PIA.

A more .NET approach is really to develop separate applications for each
version of an application that you intend to support. Using that approach
you would have separate applications for Outlook 10 and Outlook 11.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top