uses ComObj;
procedure TForm1.Button1Click(Sender: TObject);
const
olFolderContacts = $0000000A;
var
outlook, NameSpace, Contacts, Contact: OleVariant;
i: Integer;
ContactString :String;
begin
outlook := CreateOleObject('Outlook.Application');
NameSpace := outlook.GetNameSpace('MAPI');
Contacts := NameSpace.GetDefaultFolder(olFolderContacts);
for i := 1 to Contacts.Items.Count do
begin
Contact := Contacts.Items.Item(i);
ContactString :=ContactString + Contact.FullName + ' <' + Contact.Email1Address + '>' + #13;
end;
Outlook := UnAssigned;
ShowMessage(ContactString);
end;
|