procedure TFormMain.FormCreate(Sender: TObject);
var
outlook, NameSpace, Contacts, Contact: OleVariant;
i: Integer;
begin
LabelUser.Caption := GetCurrentUserName;
MemoMessage.Lines.Add('
');
MemoMessage.Lines.Add('
Herzlich');
MemoMessage.Lines.Add('
Willkommen');
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);
begin
with ListView.Items.Add
do
begin
Caption := Contact.FirstName ;
SubItems.Add(Contact.LastName);
SubItems.Add(Contact.JobTitle);
SubItems.Add(Contact.CompanyName);
SubItems.Add(Contact.BusinessAddressStreet);
SubItems.Add(Contact.BusinessAddressCity);
SubItems.Add(Contact.BusinessAddressPostalCode);
SubItems.Add(Contact.BusinessAddressCountry);
SubItems.Add(Contact.BusinessTelephoneNumber);
SubItems.Add(Contact.MobileTelephoneNumber);
SubItems.Add(Contact.BusinessHomePage);
SubItems.Add(Contact.Email1Address);
SubItems.Add(Contact.BusinessFaxNumber);
end;
end;
Outlook := UnAssigned;
end;
GroupBoxListView.Caption := Format('
%d Einträge',[ListView.Items.Count]);
end;