473,322 Members | 1,403 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

VB.NET & Various Versions Of Outlook

Hi everyone. Having problems with a utility I am writing for work.
The previous IT Director thoughtfully allowed 3 (2000, xp, 2003)
versions of outlook to be installed rather than 1. Now I need the
utility to work for all 3 versions. A previous post suggested
creating objects to detect the version of outlook, which I tried with
success. But, that's as far as I can get. No one out there shows how
to go beyond version detection to actually creating, deleting and
modifying outlook contacts, emails, and appointments. I tried creating
the extra outlook objects I need (shown bellow). So far, VB doesn't
show any errors during programming. When ran, I get an activex error:
"Cannot create Axtivex Component".

Code:
'open outlook application
Private objOutlook As Object = CreateObject("Outlook.Application")

'store outlook session
Private objNS As Object = CreateObject("Outlook.NameSpace")
'outlook folder variable
Private objFolder As Object = CreateObject("Outlook.MAPIFolder")
'outlook items variable
Private objItems As Object = CreateObject("Outlook.Items")
'outlook contact variable
Private objContact As Object = CreateObject("Outlook.ContactItem")
Private objNS As Object = CreateObject("Outlook.NameSpace") =
objOutlook.Session
doesn't create the activex component. Keep in mind, the utility works
great if I reference a specific version interop assembly. I have been
searching for the past few days without success. Has anyone else had
any success?

Thank you.

Dec 29 '05 #1
3 8247
wizzbangca,
I would recommend upgrading every one to Outlook 2003, which would allow
creating a VSTO 2.0 addin for Outlook. VSTO 2.0 greatly simplifies create
Outlook add-ins in .NET!

If upgrading is not an option, then the "easiest" way is to write your
add-in to the lowest common denominator. Write the add-in to Outlook 2000,
reference Outlook 2000 type library, compile & develop against that.
Alternatively don't reference a type library & use late binding (Object
variables).

| Private objOutlook As Object = CreateObject("Outlook.Application")
Should work as Outlook.Application is a creatable object.
| 'store outlook session
| Private objNS As Object = CreateObject("Outlook.NameSpace")
Will fail as Outlook.Namespace is NOT a creatable object, you use
objOutlook.GetNamespace to get the namespace object.

| Private objOutlook As Object = CreateObject("Outlook.Application")
| Private objNS As Object = objOutlook.GetNamespace("MAPI")
Normally what I do when using Late binding & Outlook (VBScript for example)
is to write a macro in the VBIDE in Outlook (Alt+F11 when the Outlook
Explorer window is open) for intellisense. Then change all the strongly
typed variables to Object. You could probably adopt a similar method for
late binding in VB.NET...

--
Hope this helps
Jay [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net
"wizzbangca" <wi********@yahoo.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
| Hi everyone. Having problems with a utility I am writing for work.
| The previous IT Director thoughtfully allowed 3 (2000, xp, 2003)
| versions of outlook to be installed rather than 1. Now I need the
| utility to work for all 3 versions. A previous post suggested
| creating objects to detect the version of outlook, which I tried with
| success. But, that's as far as I can get. No one out there shows how
| to go beyond version detection to actually creating, deleting and
| modifying outlook contacts, emails, and appointments. I tried creating
| the extra outlook objects I need (shown bellow). So far, VB doesn't
| show any errors during programming. When ran, I get an activex error:
| "Cannot create Axtivex Component".
|
| Code:
| 'open outlook application
| Private objOutlook As Object = CreateObject("Outlook.Application")
|
| 'store outlook session
| Private objNS As Object = CreateObject("Outlook.NameSpace")
| 'outlook folder variable
| Private objFolder As Object = CreateObject("Outlook.MAPIFolder")
| 'outlook items variable
| Private objItems As Object = CreateObject("Outlook.Items")
| 'outlook contact variable
| Private objContact As Object = CreateObject("Outlook.ContactItem")
|
|
| Private objNS As Object = CreateObject("Outlook.NameSpace") =
| objOutlook.Session
| doesn't create the activex component. Keep in mind, the utility works
| great if I reference a specific version interop assembly. I have been
| searching for the past few days without success. Has anyone else had
| any success?
|
| Thank you.
|
Jan 3 '06 #2
objOutlook.GetNamespace
Doesn't work - "Parameter not optional" error.

Jan 12 '06 #3
wizzbangca,
Did you try passing the "MAPI" parameter as I showed:

| Private objOutlook As Object = CreateObject("Outlook.Application")
| Private objNS As Object = objOutlook.GetNamespace("MAPI")
--
Hope this helps
Jay [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net
"wizzbangca" <wi********@yahoo.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
| objOutlook.GetNamespace
| Doesn't work - "Parameter not optional" error.
|
Jan 13 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: MLH | last post by:
I have an AMP application running on linux server that collects, maintains and serves up image files to web clients. On my LAN (in fact, on the same subnet) I have both the linux box and windoze...
6
by: David List | last post by:
I'm having a problem using different properties of the document object in the example javascripts in my textbook with browsers that identify themselves as using the Mozilla engine. One example of...
5
by: Florian Proch | last post by:
Hi all... i'm currently working for a big project to construct a website. We need to support some browser and OS : IE 5.0 -> IE 6, Mozilla 1.2 -> 1.7, Opera 5 -> Opéra 7.5x, Netscape 4.75 -> NS...
20
by: wolftor | last post by:
Would anyone be willing to beta test my application for me and give me some feedback? I can give you feedback in exchange (ie. if there are parts you're interested in knowing how it was done) or I...
6
by: JimmyKoolPantz | last post by:
I have been given the task of converting a program from VFP (visual foxpro) to Visual Basic.net. My question is "Is it possible to generate a DBF file Dynamically(at runtime) using Visual...
10
by: Immortalist | last post by:
Various aquisition devices that guide learning along particular pathways towards human biases. And as E.O. Wilson might say mental development appears to be genetically constrained. (1) Language...
0
by: YellowFin Announcements | last post by:
Introduction Usability and relevance have been identified as the major factors preventing mass adoption of Business Intelligence applications. What we have today are traditional BI tools that...
2
by: =?Utf-8?B?Sk1D?= | last post by:
Will any of the programs in 2007 Office Home & Student work with Office Outlook 2003? Will any of the programs in 2007 Office Home & Student do the same things as in Works 8 Word Processor, like...
0
by: Roman Optio | last post by:
Hi, I am currently working on a tool to transfer addressbook data such as contacts and organizations between Vondle and Outlook. For those of you who are wondering what Vondle is, it is an...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.