Mega Code Archive

 
Categories / Delphi / Activex OLE
 

Get address book of MS Outlook

Title: Get address book of MS Outlook This example shows, how to get contacts list from address book of MS Outlook. Don't forget add ComObj to uses chapter. uses ComObj; ... procedure TForm1.Button1Click(Sender: TObject); var OutlookObj, ObjSpace, ObjFolder: Variant; i: Integer; Str: string; begin OutlookObj:=CreateOleObject('Outlook.Application'); ObjSpace:=OutlookObj.GetNameSpace('MAPI'); ObjFolder:=ObjSpace.GetDefaultFolder(10); for i:=1 to ObjFolder.Items.Count do begin Str:=''; Str:=ObjFolder.Items[i].CompanyAndFullName+' - '+ ObjFolder.Items[i].Email1Address; Memo1.Lines.Add(Str); end; OutlookObj.Quit; end;