Programmatically Enable Addin

R

Ramesh

Forgive me if this has already been answered elsewhere (I couldn't locate any
though).

I have an Outlook addin that works in Outlook 2002 and 2003 (the only two I
support anyway). It was developed using VC++ in Visual Studio .Net 2003. It
works just fine. I need this addin to be running in Outlook and I need to
warn the user if it is not (could be because Outlook disabled it or the user
chose to disable it). How can I accomplish this?

My initial impression is that there has to be a background process that
monitors Outlook startups. This process will go and look for the LoadBehavior
and the Resiliency\DisabledItems keys in the registry and find out if the
Addin is in enabled state and if not pop-up a message box. Is this the
correct way to do this or is there a better alternative? If it is the correct
way, how can I monitor Outlook Startups?

Thanks in advance.
 
K

Ken Slovak - [MVP - Outlook]

You could iterate the COMAddIns collection of the Outlook.Application object
and check each one for Connect = true.
 
R

Ramesh

Thanks Ken. I will try out your suggestion. In the meantime, I need couple of
clarifications:

Outlook needs to be running for this solution, right? And, will this work
even if the addin is disabled by Outlook (because of some crash in the addin)?

Thanks again.
 
R

Ramesh

Another clarification: Where would this solution go? In another addin or in a
windows service that is running in the background?
 
K

Ken Slovak - [MVP - Outlook]

Yes, Outlook has to be running and if the addin was hard disabled by Outlook
it can't be connected until the registry entry for the disabling is cleared
and Outlook is restarted.
 
K

Ken Slovak - [MVP - Outlook]

Never, ever use the Outlook object model in code running in a service.
Otherwise the code could go in any type of application.
 

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