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下调试通过刚从 dfw 的离线数据库中找的,也许有用,你看看
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下调试通过刚从 dfw 的离线数据库中找的,也许有用,你看看
解决方案 »
- delphi中如何保存ToolBar的布局
- 如何让Dbgrid指定某特殊数据地行显示在第一行
- 过年有从上海到石家庄自己开车回家的朋友吗?要求付费搭车!
- 一个超级爽的地方有好多免费的片子
- 如何在SQL语句中插入字符" ' "?
- TreeView的状态图标丢失(StateIndex)
- 谁有物业管理的源代码??(100分相送)急!急!急!!
- 为什么连接不上数据库
- 关于ADOQUERY的问题!关心一下把!
- 小弟想编一套公司管理软件 ,可是客户提出了像EXCEL里面的公式输入 ,小弟现在没有足够的时间写公式编译器了不知哪位大哥有现成的代码借给小弟参考以下
- format的使用问题!!求教!!
- 在Treeview中,如何判断选中的是哪一级的节点?
var
OutlookApp,
Mapi,
Contacts,
Personal: Variant;
I: Integer;
begin
OutlookApp := CreateOleObject('Outlook.Application');Mapi := OutlookApp.GetNameSpace('MAPI');
for I := 1 to Mapi.Folders.Count do
MapiList.Items.Add(Mapi.Folders(I).Name);
Personal := Mapi.Folders('个人文件夹');
{Loop through the Personal Folders Collection and add the name
of each folder to the listbox.}
for I := 1 to Personal.Folders.Count do
PersonalList.Items.Add(Personal.Folders(I).Name);
Contacts := Personal.Folders('联系人');
for I := 1 to Contacts.Items.Count do
ContactsList.Items.Add(Contacts.Items(I).FullName);
OutlookApp := Unassigned;
end;
const
olFolderContacts = $0000000A;
var
outlook, NameSpace, Contacts, Contact: OleVariant;
i: Integer;
begin
outlook := CreateOleObject('Outlook.Application');
NameSpace := outlook.GetNameSpace('MAPI'); Contacts := NameSpace.GetDefaultFolder(olFolderContacts);
for i := 1 to Contacts.Items.Count do
begin
Contact := Contacts.Items.Item(i);
{now you can read any property of contact. For example, full name and
email address}
ShowMessage(Contact.FullName + ' <' + Contact.Email1Address + '>');
end; Outlook := UnAssigned;
end; {if you need a birthday, you can retrieve it as DateToStr(Contact.Birthday) Any contact item have a lot of properties. See a list (alphabet): Birthday
Business2TelephoneNumber
BusinessAddress
BusinessAddressCity
BusinessAddressCountry
BusinessAddressPostalCode
BusinessAddressPostOfficeBox
BusinessAddressState
BusinessAddressStreet
BusinessFaxNumber
BusinessHomePage
BusinessTelephoneNumber
CompanyAndFullName
CompanyMainTelephoneNumber
CompanyName
ComputerNetworkName
Department
Email1Address
Email1AddressType
Email1DisplayName
Email2Address
Email2AddressType
Email2DisplayName
Email3Address
Email3AddressType
Email3DisplayName
FirstName
FTPSite
FullName
FullNameAndCompany
GovernmentIDNumber
Hobby
Home2TelephoneNumber
HomeAddress
HomeAddressCity
HomeAddressCountry
HomeAddressPostalCode
HomeAddressPostOfficeBox
HomeAddressState
HomeAddressStree
HomeFaxNumber
HomeTelephoneNumber
Initials
ISDNNumber
JobTitle
Language
LastName
LastNameAndFirstName
MailingAddress
MailingAddressCity
MailingAddressCountry
MailingAddressPostalCode
MailingAddressPostOfficeBox
MailingAddressState
MailingAddressStreet
MiddleName
NickName
OfficeLocation
OrganizationalIDNumber
PersonalHomePage
PrimaryTelephoneNumber
Profession
Suffix
Title
WebPage}