#!perl
use strict;
use warnings;
use Win32::OLE;
my $outlook = Win32::OLE->new('Outlook.Application');
die unless $outlook;
my $namespace = $outlook->GetNamespace("MAPI");
for my $k (sort(keys(%{$namespace->AddressLists->Item("Global Address List")->AddressEntries("Lastname,Firstname")}))) {
printf "$k = %s\n", $namespace->AddressLists->Item("Global Address List")->AddressEntries("Lastname,Firstname")->$k;
}
####
VinsWorldcom@C:\Users\VinsWorldcom\tmp> test.pl
Address = /O=EXCHANGE/OU=ORG/CN=RECIPIENTS/CN=LASTNAFI1
AddressEntryUserType = 0
Application = Win32::OLE=HASH(0x2821978)
Class = 8
DisplayType = 0
ID = 00000000AABBCCDDEEFFAABBCCDDEEFFAABBCCDDEE00000000000000AABBCCDDEEFFAABBCCDDEEFFAABBCCDDEEFFAABBCCDDEEFFAABBCCDDEEFFAABBCCDDEEFFAABBCCDDEEFFAABBCCDDEE00
Name = Lastname,Firstname
Parent = Win32::OLE=HASH(0x28219f0)
PropertyAccessor = Win32::OLE=HASH(0x2821990)
Session = Win32::OLE=HASH(0x2821a08)
Type = EX
####
Application = Win32::OLE=HASH(0x26c16c0)
Class = 112
Parent = Win32::OLE=HASH(0x26c1720)
Session = Win32::OLE=HASH(0x26c16d8)
####
for my $k (sort(keys(%{$namespace->AddressLists->Item("Global Address List")->AddressEntries("Lastname,Firstname")->GetExchangeUser}))) {
printf "$k = %s\n", $namespace->AddressLists->Item("Global Address List")->AddressEntries("Lastname,Firstname")->GetExchangeUser->$k;
}