A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Tags: , , , ,

Outlook 2007 MAPI Replacement for VB6





 
 
Thread Tools Display Modes
  #1  
Old May 18th 07, 04:31 PM posted to microsoft.public.outlook.program_vba
ataylorm
external usenet poster
 
Posts: 1
Default Outlook 2007 MAPI Replacement for VB6

Good Morning,



I have a classic ASP page on an internal website that uses a VB6 DLL which
is downloaded to the client computer and access the MAPI components to select
contacts from their address book.



In other words I have a ASP page that sends a mass e-mail inside the company
and the user clicks a button which displays their outlook contact list, where
they select a distribution list, and that is returned to the page, which then
sends the e-mail.



The problem I have is that with Outlook 2007, MAPI isn't installed. We have
tens of thousands of PCs in three thousand locations around the world, and I
don't have the ability to control how they install Office 2007. That means I
need to find a way to make the DLL compatible until the site can be rewritten
next year.



My approach to this was to change the DLL to first try and use MAPI for
those still on outlook 2003, then if mapi couldn't be created, use the new
SelectNamesDialog to get the addresses from Outlook 2007. The problem is
that I can not get the SelectNamesDialog to work at all in VB6. I do have
the reference set for the Outlook 12 object. Here is the code I have, I am
getting error 287 application error:



Dim OutApp As New Outlook.Application
Dim oDialog As Outlook.SelectNamesDialog
Dim oAL As Outlook.AddressList
Dim oContacts As Outlook.Folder

Set oDialog = Outlook.Session.GetSelectNamesDialog
Set oContacts = OutApp.Session.GetDefaultFolder(olFolderContacts)


The Set oDialog = Outlook.Session.GetSelectNamesDialog is the line giving
me the trouble. I pulled this code from
http://msdn2.microsoft.com/en-us/library/bb176400.aspx



Any help with this would be VERY appreciated, I have been working on this
for nearly two weeks, and my boss is getting irritated.



Ads
  #2  
Old May 22nd 07, 09:05 PM posted to microsoft.public.outlook.program_vba
Eric Legault [MVP - Outlook]
external usenet poster
 
Posts: 817
Default Outlook 2007 MAPI Replacement for VB6

I think your issue is that you have early-bound references to the Outlook
2007 Object Model, and this will fail when run on machines using an earlier
version of Outlook. Declare oDialog as Object, and retrieve it from another
generic Object variable that you'd set to the Outlook.NameSpace object.

e.g.

Dim oDialog As Object
Dim objNS As Object

If Left(OutApp.Version, 2) = "12" Then
Set objNS = OutApp.GetNameSpace("MAPI")
Set oDialog = objNS.SessionGetSelectNamesDialog
End If


--
Eric Legault - Outlook MVP, MCDBA, MCTS (SharePoint programming, etc.)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


"ataylorm" wrote:

Good Morning,



I have a classic ASP page on an internal website that uses a VB6 DLL which
is downloaded to the client computer and access the MAPI components to select
contacts from their address book.



In other words I have a ASP page that sends a mass e-mail inside the company
and the user clicks a button which displays their outlook contact list, where
they select a distribution list, and that is returned to the page, which then
sends the e-mail.



The problem I have is that with Outlook 2007, MAPI isn't installed. We have
tens of thousands of PCs in three thousand locations around the world, and I
don't have the ability to control how they install Office 2007. That means I
need to find a way to make the DLL compatible until the site can be rewritten
next year.



My approach to this was to change the DLL to first try and use MAPI for
those still on outlook 2003, then if mapi couldn't be created, use the new
SelectNamesDialog to get the addresses from Outlook 2007. The problem is
that I can not get the SelectNamesDialog to work at all in VB6. I do have
the reference set for the Outlook 12 object. Here is the code I have, I am
getting error 287 application error:



Dim OutApp As New Outlook.Application
Dim oDialog As Outlook.SelectNamesDialog
Dim oAL As Outlook.AddressList
Dim oContacts As Outlook.Folder

Set oDialog = Outlook.Session.GetSelectNamesDialog
Set oContacts = OutApp.Session.GetDefaultFolder(olFolderContacts)


The Set oDialog = Outlook.Session.GetSelectNamesDialog is the line giving
me the trouble. I pulled this code from
http://msdn2.microsoft.com/en-us/library/bb176400.aspx



Any help with this would be VERY appreciated, I have been working on this
for nearly two weeks, and my boss is getting irritated.



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Outlook 2007 on Windows Vista - can't programatically create a MAPI profile Stuart Bray Outlook and VBA 8 February 21st 07 10:37 PM
MAPI gone in Outlook 2007? Brian Hampson Outlook - General Queries 4 November 15th 06 08:00 PM
Outlook 2007 Beta MAPI MsgStore-Advise mapicoder123 Outlook - Using Forms 1 September 13th 06 09:39 PM
Outlook 2007 Beta Mapi error msoc.dll Alphajoe Outlook - Installation 2 July 28th 06 07:31 AM
Any way to install replacement instance of Outlook on replacement jazzyndn Outlook - Installation 2 January 19th 06 04:51 PM


All times are GMT +1. The time now is 05:27 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2008 Outlook Banter, part of the NewsgroupBanter project.
The comments are property of their posters.
Remortgages - Mortgages - Jewelry Necklaces - Mortgage - Debt Help