Examples Delphi

The following code retrieves email addresses from MS Outlook:

uses
ComObj;
var
Outlook, NameSpace, AddressList, AddressEntries: Variant;
i: Integer;
begin
Outlook := CreateOleObject('Outlook.Application');
NameSpace := Outlook.GetNameSpace('MAPI');
AddressList := NameSpace.AddressLists('Personal Address Book');
AddressEntries := AddressList.AddressEntries;
for i := 0 to AddressEntries.Count - 1 do
Memo1.Lines.Add(AddressEntries.Item(i).name + ' (' + AddressEntries.Item(i).Address + ')');
end;