Announcement

Collapse
No announcement yet.

Outlook + Adressen

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Outlook + Adressen

    hi,

    kann mir jemand sagen, wie ich aus Delhi auf die Adressen/Kontakte von Outlook 98 / 2000 zugreifen kann?
    Bin für jeden Tip DANKBAR!!
    Ein kleines Beispiel wäre SUPPER!!

    Gruß

    Harald

  • #2
    Hallo,

    das folgende Beispiel demonstriert den Zugriff über Delphi 5:
    <pre>
    unit KontakteD5Frm;

    interface

    uses
    Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
    StdCtrls, OleServer, Outlook2000;

    type
    TForm1 = class(TForm)
    OutlookApplication1: TOutlookApplication;
    Button1: TButton;
    ListBox1: TListBox;
    procedure Button1Click(Sender: TObject);
    private
    { Private-Deklarationen }
    public
    { Public-Deklarationen }
    end;

    var
    Form1: TForm1;

    implementation

    {$R *.DFM}

    procedure TForm1.Button1Click(Sender: TObject);
    var
    aNameSpace : NameSpace;
    aContacts : MAPIFolder;
    aContactItem : ContactItem;
    iCnt : Integer;
    begin
    OutlookApplication1.Connect;
    aNameSpace := OutlookApplication1.GetNamespace('MAPI');
    aContacts := aNameSpace.GetDefaultFolder(olFolderContacts);
    for iCnt := 1 to aContacts.Items.Count do
    begin
    aContactItem := aContacts.Items.Item(iCnt) as ContactItem;
    ListBox1.Items.Add(Format('%s : %s', [aContactItem.FirstName,
    aContactItem.Email1Address]));
    end;
    OutlookApplication1.Disconnect;
    end;

    end.
    </pre>
    Die Beschreibung dazu sowie weitere Beispiele für Delphi 4 sind in meinem Buch <i>COM/DCOM/COM+ mit Delphi</i> zu finden

    Comment

    Working...
    X