Outlook com add in questions




I have followed instructions here http://support.microsoft.com/?kbid=302896
to successfully test my first com add in. I have a few questions;

1. Will this .net created com add in work in any version of Outlook?

2. How do I deploy this add in to clients (i.e. remote users)?

3. Is there a way to manually remove/load/unload such an add in in outlook
2003 and 2007?

Many Thanks



Two more questions;

1. How do I add functionality to this add-in to trap ItemSend event in

2. If an external application uses outlook to send email as below;

em = OutlookApp.CreateItem(FromTemplate(EmailTemplate)
em.UserProperties.Add("PropName", "PropValue")

does com add-in have access to user property value "PropName"?



Ken Slovak - [MVP - Outlook]

1. If compiled on an Outlook 2003 machine with the Outlook 2003 PIA's the
code will work also in Outlook 2007. For versions earlier than 2003 you just
about have to use individual addins targeted at the version you want to
support. There are no official Outlook 2000 PIA's, you have to modify the
Outlook 2002 PIA for that.

A rule of thumb is to compile on the earliest version you want to support.

Be aware also that for almost all Outlook 2003 systems you will need to
deploy the redistributable Office 2003 PIA's plus extensibility.dll and
stdole.dll plus any other dependencies.

Add-In Express claims to have version neutral PIA's that let you target
multiple versions of Outlook with one addin but you must use their frameword
for development then.

2. Deploying a shared addin without shimming it is bad practice. It puts all
unshimmed managed code addins into one AppDomain, where if any crashes or
causes errors the result is that all the addins in that AppDomain can become
disabled. Always use a shim. Use Google to search for the COM Shim Wizard.

You also need an installer and in most cases you want to sign your code with
a code signing certificate so you can use strong naming.

VS can generate a setup package.

3. You can disable an addin registered in HKCU from the COM Add-Ins dialog,
or by changing LoadBehavior in the registry from 3 to 2. Normally if you use
a Windows Installer compatible setup package, which can be produced by VS,
you uninstall from the Control Panel's Add/Remove Programs.

I'd suggest that if you are new to all this that you spend time looking at
the information and samples on www.outlookcode.com.

Ken Slovak - [MVP - Outlook]

Application.ItemSend or the Send event for an Item? What language are you
programming in?

If you get the same item, possibly from ActiveInspector.CurrentItem you
should have access to any property that is on the item.


Application.ItemSend I think, something that traps when user sends an email
by pressing Send on toolbar. Using vb.net



Andrei Smolin [Add-in Express]

Hello John,

1. Both VSTO and the Shared Add-in wizard create add-in projects based on
the PIAs version (= Office version) installed on your PC. They will work
with higher Office versions because they are almost 100% compatible with
older ones. To access properties and methods of a higher Office version, you
use late binding. To access events of a higher Office version, you will have
to study PIAs via .NET Reflector and write a similar code.

Add-in Express creates projects based on Office 2000 regardless of the
Office version you have installed on your PC. Also, you can use the version
installed. To access properties and methods of a higher Office version, you
use late binding. To access events of a higher Office version, you use the
version-independent Outlook Events component and a number of
version-independent Outlook Event classes. The default behavior of command
bar and ribbon components in Add-in Express allows you to create one add-in
that will show command bars in pre-2007 versions and Ribbon tabs in Outlook

2. VSTO, Shared Add-in, and Add-in Express create setup projects
automatically. However, Add-in Express adds an appropriate pre-compiled
setup action, depending on the shim type you use: non-isolated (that's the
shared add-ins way), VSTO Loader, or Add-in Express Loader. See shims
compared at http://www.add-in-express.com/docs/net-deploying-addins.php.

Add-in Express provides a unique feature: ClickOnce deployment for add-ins
(see http://www.add-in-express.com/docs/net-clickonce-solution.php). This
technology allows a non-admin user to install an add-in from a web-site. See
an introductory notes on ClickOnce at

3. The user can unload the add-in via the COM Add-ins dialog. In Outlook
2003, you can find it in the menu Tools | Options | Other | Advanced Options
| COM Add-ins. To add this item to a command bar see

Regards from Belarus,

Andrei Smolin
Add-in Express Team Leader

Ken Slovak - [MVP - Outlook]

Just follow the snippet Andrei showed in his answer to set up an event
handler for Application.ItemSend.

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