Accessing the Global Address List using VBA 
Author Message
 Accessing the Global Address List using VBA

Hi,

We have written a database application that refers to users and e-mail
addresses in several locations. We have a customer who wants to use a
modified version of this application but they do not want to populate and
maintain the user and e-mail information since the company has over 50000
employees and has all this information already stored in its Exchange
servers.

So, I wanted to pop-up the Global Address List whenever data is required and
use the returned information in my application. I can recall using the
following demo code to obtain this but the code no longer seems to work.
Even creating the MAPI session doesn't work. What am I missing here?
I'm running Windows XP (Service Pack 1 installed) with Office XP and I
thought no further action was required. Do I still have to install CDO and
if so which version and where can I find it?

Thanks a lot!
Alain
Belgium

Private Sub Command1_Click()
  Set A = CreateObject("MAPI.Session")
  S = A.Logon

  On Error GoTo err_AddressBook
  Set R = A.AddressBook
  For i = 1 To R.Count
    R.Item(i).resolve
    Print (R.Item(i).AddressEntry.Name)
  Next i

  Exit Sub

err_AddressBook:
  If (Err <> &H80040113) Then MsgBox "Unrecoverable Error: " & Err
End Sub



Sun, 15 May 2005 00:09:24 GMT  
 Accessing the Global Address List using VBA
CDO is an optional installation with Outlook 2000 and later. You have
to select to install it from the Office CD under the Outlook section.

You might want to look at the ItemsCB COM addin sample on the
Resources page at www.microeye.com, it has code to demand load CDO if
it's not already installed. The user would need access to the Office
installation point of course.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Lead Author, Professional Outlook 2000 Programming, Wrox Press
Lead Author, Beginning VB 6 Application Development, Wrox Press
Attachment Options
http://www.slovaktech.com/attachmentoptions.htm
Extended Reminders
http://www.slovaktech.com/extendedreminders.htm


Quote:
> Hi,

> We have written a database application that refers to users and
e-mail
> addresses in several locations. We have a customer who wants to use
a
> modified version of this application but they do not want to
populate and
> maintain the user and e-mail information since the company has over
50000
> employees and has all this information already stored in its
Exchange
> servers.

> So, I wanted to pop-up the Global Address List whenever data is
required and
> use the returned information in my application. I can recall using
the
> following demo code to obtain this but the code no longer seems to
work.
> Even creating the MAPI session doesn't work. What am I missing here?
> I'm running Windows XP (Service Pack 1 installed) with Office XP and
I
> thought no further action was required. Do I still have to install
CDO and
> if so which version and where can I find it?

> Thanks a lot!
> Alain
> Belgium

> Private Sub Command1_Click()
>   Set A = CreateObject("MAPI.Session")
>   S = A.Logon

>   On Error GoTo err_AddressBook
>   Set R = A.AddressBook
>   For i = 1 To R.Count
>     R.Item(i).resolve
>     Print (R.Item(i).AddressEntry.Name)
>   Next i

>   Exit Sub

> err_AddressBook:
>   If (Err <> &H80040113) Then MsgBox "Unrecoverable Error: " & Err
> End Sub



Sun, 15 May 2005 04:35:33 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Access the Global Address List in VBA.

2. VBA: Global Address List

3. How to open the Global Address List using vb

4. Add new members to a Global Address List using VB

5. Using the Global Address List with VB

6. accessing global address list

7. Accessing Global Address List on Exchange Server???

8. Accessing Outlook "Global Address List"

9. Obtaining email addresses from Global Address List

10. smtp email addresses in the Outlook global address list

11. Print Members in Global Address List or Personal Address book

12. Outlook VBA:Add recipient to a distribution list in the Global Addtress List

 

 
Powered by phpBB® Forum Software