uses ComObj;
function EMail(such: string): string;
var
Outl, Kontakte, Contact, NSpace: OleVariant;
x: Integer;
begin
result := 'Nicht gefunden';
such := ansilowercase(such);
Outl := CreateOleObject('Outlook.Application');
NSpace := Outl.GetNameSpace('MAPI');
Kontakte := NSpace.GetDefaultFolder(10);
for x := 1 to Kontakte.Items.Count do
begin
Contact := Kontakte.Items.Item(x);
if pos(such, Ansilowercase(Contact.LastName)) > 0 then begin
if Contact.Email1Address <> '' then
result := Contact.Email1Address;
break;
end;
end;
Outl := UnAssigned;
end;
procedure TForm1.Button5Click(Sender: TObject);
begin
showmessage(EMail('Lehmann'));
end;
{
Contact.Account
Contact.Actions
Contact.Anniversary
Contact.Application
Contact.AssistantName
Contact.AssistantTelephoneNumber
Contact.Attachments
Contact.BillingInformation
Contact.Birthday
Contact.Body
Contact.Business2TelephoneNumber
Contact.BusinessAddress
Contact.BusinessAddressCity
Contact.BusinessAddressCountry
Contact.BusinessAddressPostalCode
Contact.BusinessAddressPostOfficeBox
Contact.BusinessAddressState
Contact.BusinessAddressStreet
Contact.BusinessFaxNumber
Contact.BusinessHomePage
Contact.BusinessTelephoneNumber
Contact.CallbackTelephoneNumber
Contact.CarTelephoneNumber
Contact.Categories
Contact.Children
Contact.Companies
Contact.CompanyAndFullName
Contact.CompanyMainTelephoneNumber
Contact.CompanyName
Contact.ComputerNetworkName
Contact.CreationTime
Contact.CustomerID
Contact.Department
Contact.Email1Address
Contact.Email1AddressType
Contact.Email1DisplayName
Contact.Email1EntryID
Contact.Email2Address
Contact.Email2AddressType
Contact.Email2DisplayName
Contact.Email2EntryID
Contact.Email3Address
Contact.Email3AddressType
Contact.Email3DisplayName
Contact.Email3EntryID
Contact.EntryID
Contact.FileAs
Contact.FirstName
Contact.FormDescription
Contact.FTPSite
Contact.FullName
Contact.FullNameAndCompany
Contact.Gender
Contact.GetInspector
Contact.GovernmentIDNumber
Contact.Hobby
Contact.Home2TelephoneNumber
Contact.HomeAddress
Contact.HomeAddressCity
Contact.HomeAddressCountry
Contact.HomeAddressPostalCode
Contact.HomeAddressPostOfficeBox
Contact.HomeAddressState
Contact.HomeAddressStree
Contact.HomeAddressStreet
Contact.HomeFaxNumber
Contact.HomeTelephoneNumber
Contact.Importance
Contact.Initials
Contact.ISDNNumber
Contact.JobTitle
Contact.Journal
Contact.Language
Contact.LastModificationTime
Contact.LastName
Contact.LastNameAndFirstName
Contact.MailingAddress
Contact.MailingAddressCity
Contact.MailingAddressCountry
Contact.MailingAddressPostalCode
Contact.MailingAddressPostOfficeBox
Contact.MailingAddressState
Contact.MailingAddressStreet
Contact.ManagerName
Contact.MessageClass
Contact.MiddleName
Contact.Mileage
Contact.MobileTelephoneNumber
Contact.NickName
Contact.NoAging
Contact.OfficeLocation
Contact.OrganizationalIDNumber
Contact.OtherAddress
Contact.OtherAddressCity
Contact.OtherAddressCountry
Contact.OtherAddressPostalCode
Contact.OtherAddressPostOfficeBox
Contact.OtherAddressState
Contact.OtherAddressStreet
Contact.OtherFaxNumber
Contact.OtherTelephoneNumber
Contact.OutlookInternalVersion
Contact.OutlookVersion
Contact.PagerNumber
Contact.Parent
Contact.PersonalHomePage
Contact.PrimaryTelephoneNumber
Contact.Profession
Contact.RadioTelephoneNumber
Contact.ReferredBy
Contact.Saved
Contact.SelectedMailingAddress
Contact.Sensitivity
Contact.Size
Contact.Spouse
Contact.Subject
Contact.Suffix
Contact.TelexNumber
Contact.Title
Contact.TTYTDDTelephoneNumber
Contact.UnRead
Contact.User1
Contact.User2
Contact.User3
Contact.User4
Contact.UserCertificate
Contact.UserProperties
Contact.WebPage
Contact.YomiCompanyName
Contact.YomiFirstName
Contact.YomiLastName
}