procedure TForm1.FormCreate(Sender: TObject);
var Ns:_NameSpace;
i:integer;
begin
self.OutlookApplication1.Connect;
Ns:=OutlookApplication1.GetNamespace('MAPI');
for i:=1 to Ns.AddressLists.Count do
ListBox1.Items.Add(Ns.AddressLists.Item(i).Name);
self.OutlookApplication1.disConnect;
end;
procedure TForm1.ListBox1Click(Sender: TObject);
var Ns:_NameSpace;
Ad:AddressEntries;
i:integer;
begin
if Listbox1.ItemIndex<0 then exit;
self.OutlookApplication1.Connect;
Ns:=OutlookApplication1.GetNamespace('MAPI');
//Ns.Logon(emptyparam,emptyparam,true,true);
Ad:=Ns.AddressLists.Item(Listbox1.ItemIndex+1).AddressEntries;
for i:=1 to Ad.Count do
ListBox2.Items.Add(Ad.item(i).name+' '+Ad.item(i).Address);
//Ns.Logoff;
self.OutlookApplication1.DisConnect;
end;
d6下调试通过