![]() |
Properties mit Variablen ansprechen?
Hallo,
ich baue im Moment an einem kleinen Programm mit Zugriff auf Outlook. Um an die Kontakte zu kommen verwende ich folgenden Code:
Delphi-Quellcode:
Contact ist ein Objekt vom Typ ContactItem. Diese Objekt hat nun sehr viele verschiedene Properties, wie zum Beispiel FirtsName, LastName, EntryID, ...
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); Name := Contact.LastName; [....] Um nun die ganze Geschichte variabel zu gestalten, möchte ich die Properties in einen Array speichern. Dies soll wie folgt aussehen:
Delphi-Quellcode:
Zurück zu, ersten Codesegment - jetzt muss "Name := Contact.LastName;" angepasst werden, da LastName ja aus dem Array kommen soll. Irgendwie in der Art: "Name := Contact. OutlookConsts[2].Name;"
type TOutlookConstants = record
Caption : string; Name : string; end; var OutlookConsts = array of TOutlookConstants Geht das irgendwie? Gruss |
Re: Properties mit Variablen ansprechen?
Es müsste etwa
Delphi-Quellcode:
heißen, also ohne Contact davor, da OutlookConsts ja keine Property von Contact ist.
Name := OutlookConsts[2].Name;
MfG Binärbaum |
Alle Zeitangaben in WEZ +1. Es ist jetzt 17:06 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz