473,395 Members | 1,677 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,395 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 8252
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.