Einzelnen Beitrag anzeigen

mr2

Registriert seit: 3. Mai 2003
140 Beiträge
 
Delphi 2006 Enterprise
 
#6

Re: Outlook- Adressen auslesen

  Alt 18. Aug 2003, 09:42
Falls Du die Outlook-Kontakte meinst probiers mal damit,
funktioniert dank später Bindung mit allen Outlook-Versionen.
Delphi-Quellcode:
const
  // Wert des Standard-Kontakte-Ordners in Outlook
  OL_FOLDER_CONTACTS = $0000000A;
var
  OutlApp, OutlNS, Folder, ItemColl, Contact: OleVariant;
  i, Count: Integer;
begin
  OutlApp := CreateOleObject('Outlook.Application');
  OutlNS := OutlApp.GetNameSpace('MAPI');
  Folder := OutlNS.GetDefaultFolder(OL_FOLDER_CONTACTS);
  ItemColl := Folder.Items;
  Count := ItemColl.Count;
  for i:=1 to Count do begin
    Contact := ItemColl.Item(i);
    try
      Memo1.Lines.Add(Contact.FirstName);
    except
      Continue;
    end; // um Fehler wegzufangen, falls Kontakt eine Verteilerliste ist
    Memo1.Lines.Add(Contact.LastName);
    Memo1.Lines.Add(Contact.CompanyName);
    Memo1.Lines.Add(Contact.BusinessTelephoneNumber);
    Memo1.Lines.Add(Contact.Business2TelephoneNumber);
    Memo1.Lines.Add(Contact.HomeTelephoneNumber);
    Memo1.Lines.Add(Contact.Home2TelephoneNumber);
    Memo1.Lines.Add(Contact.MobileTelephoneNumber);
    Memo1.Lines.Add(Contact.Email1Address);
    Memo1.Lines.Add(Contact.Email2Address);
  end;
  Contact := Unassigned;
  ItemColl := Unassigned;
  Folder := Unassigned;
  OutlNS := Unassigned;
  OutlApp := Unassigned;
  Mit Zitat antworten Zitat