views:

150

answers:

2

Can someone give me a quick explanation of when I would use Visual Studio 2008 Outlook 2007 Ad-In project type? and how would that compare to developing a bunch of outlook macros directly in outlook?

Basically, I want to have some sort of application read email (with attachments) from a pop3 email box, do some filtering/editing/validation of the subject/sender/content and then if certain conditions are met, save the attachments to a local file, and then add an entry into an SQL server database table (i.e. date/sender/subject/message).

Seems there are at least 10 different ways to do this....so between an outlook macro and a VS Office Project, how do I pick?

I am not clear, if I create this solution as a Visual Studio outlook add-in, where does it run? Is it loaded into outlook, does it run as a separate process and communicates back and forth with outlook? if outlook is not running, does it start it?

+1  A: 

This is an example of an outlook add-in.. Personally, I don't see macros distributable.

Leo Jweda
+2  A: 

An Outlook Add-on is a compiled component that uses the Outlook API to perform the tasks you need. A macro/VB script is an interpreted script that actually uses the same API. The add-on approach is better if you want to deploy your functionality.

When you work on an Outlook add-on in Visual Studio, you'll be creating a .NET component, which integrates into the Outlook application, which is written in C++ so uses COM. You'll have to be careful about managed/unmanaged types and releasing objects you retrieve from Outlook.

I have recently completed just such a tool, but I chose to use Add-in Express (http://www.add-in-express.com/). These guys provide a layer of abstraction over the [challenging] Outlook API and also provide some excellent support if you're stuck.

In my case, with Add-in Express, I "run" by setting Outlook as the application command to run, in the Project properties. Add-in Express sorts out the installation of the add-on within Outlook. So when I press "Run", Outlook starts and my add-in is displayed, which may be debugged in the normal fashion. I'm not sure how VSTO (Visual Studio Tools for Office) works in this respect - or at least, I can't remember.

Program.X
So in my case, if this will be used by a single user, to process emails as they arrive and perform some actions if certain conditions are met, would either approach work? - seems like maybe a macro would be easier...but how does performance compare? do you know?
EJB
If it's just for one user, then a macro would be fine. In my experience, deploying compiled Add-ons to clients can be a pain. A macro would almost always work by virtue of its simplicity. But I have no experience of macros, I'm afraid.The API is similar, so if you need to scale up, you'll probably find it quite easy migrate it to .NET once you've found your way around the Outlook API.
Program.X