Downloading Outlook Global Address List

So… You are finally fed up and are going to leave your company. But as a parting gift, you want to get everyone’s name and e-mail address and sell it to spammers. Tsk! Tsk!

But jokes aside, there are times when having your company’s address book on your computer may be beneficial.

Whether you are traveling without VPN access and do not have direct access to your company’s Exchange server, or perhaps when your internet connection is down, you may want a local copy of the Outlook address book. An automated solution for acquiring this data would be quite handy!

The solutions is actually quite simple – VBScript! Yes, yes.. I know.

First, however, let’s get some assumptions out of the way. This solution works by querying the Microsoft Exchange Server and enumerating the Global Address List (aka. GAL). This of course assumes that your company uses Microsoft Exchange as the email server and the company address book is maintained by Exchange. Most likely if you use Microsoft Outlook or your email and you have access to contacts that you did not explicitly enter then you have an Exchange Server. It is also assumed that you are using a Windows-based system and have the connection to the Exchange server when you execute the script.

What You Need:

  1. A computer with Outlook on it that you use for your emails
  2. Text editing application (i.e. Windows Notepad)
  3. An Internet connection (to download a Microsoft Outlook Add-On)
  4. A working connection to your Exchange Server – meaning you can send and receive emails
  5. Some space on your hard drive to store the Outlook database – depending on the size of you company, the size requirement may vary.

The Steps:

  1. Download and install “Microsoft Exchange Server MAPI Client and Collaboration Data Objects”In order to access the Outlook GAL, you need to download an Outlook Add-On that provides access to Outlook Application Programming Interface (API).
    Microsoft does not include these by default with Outlook installation. At the time of this writing, an installation package is available for
    download here.
    Of course, you can always just Google “MAPI download” (MAPI = Messaging API).
  2. Once the MAPI client is installed, you need to do a little coding (text editing, in this case).
    • Download the OutlookGAL.vbs script.
    • Open it in your favorite text editor ( i.e. Start->Run->notepad )
    • Change the “ServerName” variable to the name of your Excahnge server
    • Change the “UserName” variable to your Exchange user name – this is typically the part of your e-mail address before the ‘@’
    • If desired, specify a different path in the “OutputFileName” variable
    • Save your changes
  3. Run the script, by double-cliking OutlookGAL.vbs file

You may get a popup from Outlook notifying you that a script is trying to access the Outlook Address Book.
In this case, select ‘Allow Access’ for 10 minutes or so. If that is not enough time, you will get another
popup once that time period has elapsed. When the script is done executing, a popup message will be
displayed. The file pointed to by the “OutputFileName” variable should now contain address book data from your
Exchange Server. Note that the database items are separated with a “tab”, which makes it easy to import
the text file into Excel – the fields will be imported into separate columns.

The script queries what I deemed to be the most useful address book fields.
There are other fields that can be queried as well and you can look them up in CDO reference.