Entwickler-Ecke

Windows API - EMail-Adressen auslesen aus Outlook-Kontakt


JoelH - Mi 05.10.16 13:27
Titel: EMail-Adressen auslesen aus Outlook-Kontakt
Ich möchte gerne sämliche Emailadressen eines Outlookkontaktes auslesen. Mit folgenden Code erhalte ich die Hauptadresse, aber ich hätte gerne den gesamten Block ausgelesen, den man in dem Dialog im angefügten Pic sieht.

Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
procedure TForm1.auslesen;
var
  application: OleVariant;
  dialog: OleVariant;
  i: Integer;
  recipients: String;
  recipient,  myAddressList , Myentry, MyContact: OleVariant;
  s : TStrings;
begin
  ListBox1.Clear;

   application := createOleObject( 'Outlook.Application' );
  myAddressList := Application.Session.AddressLists('Globale Adressliste')  ;
  recipient := myAddressList.AddressEntries;
  for i := 1 to  recipient.count do
  begin
      Myentry := recipient.item( i );

      ListBox1.Items.Add(Myentry.name);
      if Myentry.DisplayType = 0 then
      begin
        try
          MyContact :=  Myentry.GetExchangeUser;
          ListBox1.Items.Add(MyContact.PrimarySmtpAddress);
        finally
          //
        end;

      end;
  end;
end;


Der Code, bzw. PrimarySmtpAddress, gibt mir nur joel.hopingman(at)joelh.de zurück. Ich hätte aber gerne beide Adressen zurück, gerne auch als Stringlist oder so, das smtp: kann gerne mit dabei stehen.


Delete - Mi 05.10.16 19:11

- Nachträglich durch die Entwickler-Ecke gelöscht -