Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   Delphi Properties mit Variablen ansprechen? (https://www.delphipraxis.net/42759-properties-mit-variablen-ansprechen.html)

hitzi 23. Mär 2005 13:22


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:
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;
      [....]
Contact ist ein Objekt vom Typ ContactItem. Diese Objekt hat nun sehr viele verschiedene Properties, wie zum Beispiel FirtsName, LastName, EntryID, ...

Um nun die ganze Geschichte variabel zu gestalten, möchte ich die Properties in einen Array speichern. Dies soll wie folgt aussehen:
Delphi-Quellcode:
type TOutlookConstants = record
        Caption : string;
        Name : string;
end;

var OutlookConsts = array of TOutlookConstants
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;"

Geht das irgendwie?

Gruss

Binärbaum 31. Mär 2005 23:52

Re: Properties mit Variablen ansprechen?
 
Es müsste etwa
Delphi-Quellcode:
Name := OutlookConsts[2].Name;
heißen, also ohne Contact davor, da OutlookConsts ja keine Property von Contact ist.

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