MAPILogonComplete Event does not always fire for addin

B

Bruce Felknor

I have read other threads in this group about the MAPILogonComplete event and a caution about forcing MAPI logon from an Outlook addin by accessing a MAPI namespace property, such as currentuser. Dmitry Streblechenko cautions that it is best to wait as long as possible to do anything in an addin that requires MAPI logon.

Working in VB(6) on an Outlook 2003 addin, I've noticed that an addin will sometimes not receive the MAPILogonComplete event at all.

The addin code sets a variable (declared WithEvents) to the Outlook.Application in IDTExtensibility_StartupComplete event and waits for the MAPILogonComplete event to fire.

In environments experiencing occasional latency problems (networking, PC performance...I'm not at all sure of all the possible causes of the latency) that the MAPILogonComplete event does not fire every time during startup.

I'm wondering if some kind of latency could be the problem (and the addin startup complete occurs *after* MAPILogonComplete would have fired) or...

In any case, if an addin cannot rely on that event firing, at some point it would have to force the MAPI Logon. In light of the caution noted at the top of this topic, I'd like to know more about *how* and *when* to logon. How long should it wait ? What is the best method to use to know if enough time has passed ?

In Outlook 2003 when running in Cached Mode Exchange, there is refresh interval for synchronization (75 seconds by default) -- is this part of the reason for waiting to logon ?

Additionally, in many larger environments, Outlook may have (many) other addins (some of which are implemented as InfoStores and provide their own MAPI Trees, etc...) all of which are competing for resources, especially during startup.... In such environments, it is critical to implement resilient (and friendly !) addins.....

I'd like to better understand the nuances of Outlook startup, MAPI Logon and event notification and discuss fool-proof methods for successfully completing MAPI Logon in a manner that does not adversely affect Outlook and other Outlook addins.

Thanks !

Bruce
bfelknor at gmail dot com
 
K

Ken Slovak - [MVP - Outlook]

Dmitry knows more about this than I do certainly, but why are you using the
MAPILogonComplete() event at all? Is this an attempt to let Outlook get
started up and stable before doing your thing in your addin? You have no
control not only over latency and other addins, but if any other addins are
managed code and have to start the CLR then you have that latency to deal
with also, which could be many seconds.

If your startup isn't time critical just set a timer in OnConnection() to
fire maybe a minute after OnConnection() ends. You can't always rely on
OnStartupComplete() or MAPILogonComplete() firing, what if the user connects
your addin from the COM Add-Ins dialog and your OnConnection()
ext_ConnectMode property value isn't ext_cm_Startup? Those events would
never fire at all.
 
B

Bruce Felknor

Ken,

Yes, I'm trying to let Outlook get up and going -- but the addin needs to start in as timely a fashion as possible, ideally as soon as Outlook is "ready."

I've been around the block on waiting for fixed time periods to try to start-up. In many environments it works, but in others...no soap. The addin does not allow users to add/remove it from the COM Add-Ins dialog, so that's not an issue in this case, but I take your point.

What I'm after is an industrial strength approach to what is a basic addin requirement. Obviously there are reasons why an addin needs to dodge around loggin on and I want to get at what the reasons are.

Thanks for your reply !
 
D

Dmitry Streblechenko

What do you mean by "sometimes not receive the sometimes not receive the
MAPILogonComplete event at allevent at all"?
Do you have a particular scenario when thaat happens?
If some external app creates an instance of the Outlook.Application object,
but never ends up doing anything usefull, MAPILogonComplete certainly won't
fire.

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
 

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