References to different versions of MS Outlook in a VB.NET application

C

Chet

I am writing an application that utilizes a reference to Microsoft
Outlook. (Added a reference to the MS Outlook COM interface to my
project). I then write code such as:

dim olApp as new Outlook.Applicaiton
dim olNamespace as OutlOok.Namespace = olApp.....

I am deploying my application via the "publish" feature that makes it
downloadable and installable via the web.

The problem I'm running into is that I need the application to work with
various versions of Outlook (2003 & 2007, currently), or to not
utilize outlook at all. I can write error handling codes inside the
program to check for what version they have installed, but am running
into two problems.

1. Compiling: I am developing the application on a computer with OL 2007
(v.12), and can therefore not add a reference for the OL 2003 (v.11) COM
reference. I tried copying the project to another computer with OL 2003
and adding the reference there, but then it complains about not having
OL 2007. I've thought about just using late binding ("dim olApp as
object = createobject("Outlook.Application")") but really don't want to
go that route if I can avoid it.

2. Deploying: If I do compile the program using OL 2007 references and
they try to deploy / install to a computer without Outlook or with
Outlook 2003, it will not install because it needs the office 12.0
libraries installed in the GAC beforehand.

Is there a workaround for these two issues to make my application not
quite so dependent upon the references to specific versions of outlook,
yet still be able to do early binding throughout my code?
 
C

cfps.Christian

I am writing an application that utilizes a reference to Microsoft
Outlook. (Added a reference to the MS Outlook COM interface to my
project). I then write code such as:

dim olApp as new Outlook.Applicaiton
dim olNamespace as OutlOok.Namespace = olApp.....

I am deploying my application via the "publish" feature that makes it
downloadable and installable via the web.

The problem I'm running into is that I need the application to work with
various versions of Outlook (2003 & 2007, currently), or to not
utilize outlook at all. I can write error handling codes inside the
program to check for what version they have installed, but am running
into two problems.

1. Compiling: I am developing the application on a computer with OL 2007
(v.12), and can therefore not add a reference for the OL 2003 (v.11) COM
reference. I tried copying the project to another computer with OL 2003
and adding the reference there, but then it complains about not having
OL 2007. I've thought about just using late binding ("dim olApp as
object = createobject("Outlook.Application")") but really don't want to
go that route if I can avoid it.

2. Deploying: If I do compile the program using OL 2007 references and
they try to deploy / install to a computer without Outlook or with
Outlook 2003, it will not install because it needs the office 12.0
libraries installed in the GAC beforehand.

Is there a workaround for these two issues to make my application not
quite so dependent upon the references to specific versions of outlook,
yet still be able to do early binding throughout my code?

A company I worked for had the exact same problem. The way they
solved it for years was to compile the program on a machine with the
older outlook on it since they are backwards compatible.

They ended up solving it by writing a web service that would do all
the e-mailing this way they didn't have to recompile for anything and
the only computer that needed the outlook reference was the one with
the web service.
 
C

Chet

I think I've tried this (compiled on the computer with older version)
and that would probably work, kind of. However, I want the program to
also run if the user doesn't have Outlook installed *at all* (it's kind
of an optional "feature") and so far haven't gotten anywhere with this.
 
C

Chet

Chet said:
I think I've tried this (compiled on the computer with older version)
and that would probably work, kind of. However, I want the program to
also run if the user doesn't have Outlook installed *at all* (it's kind
of an optional "feature") and so far haven't gotten anywhere with this.

I think I got this to work, or at least am making some progress. I went
to my references and changed it to "copy local" intead of "required" for
the outlook; it then installs fine. ... and the weird thing is, I am
using the OL 2007 reference on my develop / build computer and OL 2003
on my test computer, and it works just fine!
 

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