T
tristones
Unregistered / Unconfirmed
GUEST, unregistred user!
我有如下问题。在这个程序
procedure TForm1.OpenBtnClick(Sender: TObject);
var
OutlookApp,
Mapi,
Contacts,
Personal: Variant;
I: Integer;
begin
{ Get the Outlook Application object. }
OutlookApp := CreateOleObject('Outlook.Application');
{ Get the MAPI NameSpace object. }
Mapi := OutlookApp.GetNameSpace('MAPI');
{ Loop through the MAPI Folders collection and add the
Name of each folder to the listbox. }
for I := 1 to Mapi.Folders.Count do
MapiList.Items.Add(Mapi.Folders(I).Name);
{ Get the Personal folder from the MAPI folders
collection. }
Personal := Mapi.Folders('Personal 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);
{ Get the Contacts folder from the Personal Folders
collection. }
Contacts := Personal.Folders('Contacts');
{ Loop through the Contacts folder's Items collection
and add the FullName property of each Item
to the listbox. }
for I := 1 to Contacts.Items.Count do
ContactsList.Items.Add(Contacts.Items(I).FullName);
{ Close Outlook. }
OutlookApp := Unassigned;
end;
其中最后的ContactsList.Items.Add(Contacts.Items(I).FullName);
程序运行的时候报错说FullName是不支持的方法。但是我改成
ContactsList.Items.Add(Contacts.Items(1).FullName);就可以显示具体的姓名。改成范围内的数字也都没有问题。
请教这个问题如何解决。也希望大家多讨论关于office automation的问题。特别是如何把office和Web结合。
把office的自动化服务使用在Web中。
procedure TForm1.OpenBtnClick(Sender: TObject);
var
OutlookApp,
Mapi,
Contacts,
Personal: Variant;
I: Integer;
begin
{ Get the Outlook Application object. }
OutlookApp := CreateOleObject('Outlook.Application');
{ Get the MAPI NameSpace object. }
Mapi := OutlookApp.GetNameSpace('MAPI');
{ Loop through the MAPI Folders collection and add the
Name of each folder to the listbox. }
for I := 1 to Mapi.Folders.Count do
MapiList.Items.Add(Mapi.Folders(I).Name);
{ Get the Personal folder from the MAPI folders
collection. }
Personal := Mapi.Folders('Personal 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);
{ Get the Contacts folder from the Personal Folders
collection. }
Contacts := Personal.Folders('Contacts');
{ Loop through the Contacts folder's Items collection
and add the FullName property of each Item
to the listbox. }
for I := 1 to Contacts.Items.Count do
ContactsList.Items.Add(Contacts.Items(I).FullName);
{ Close Outlook. }
OutlookApp := Unassigned;
end;
其中最后的ContactsList.Items.Add(Contacts.Items(I).FullName);
程序运行的时候报错说FullName是不支持的方法。但是我改成
ContactsList.Items.Add(Contacts.Items(1).FullName);就可以显示具体的姓名。改成范围内的数字也都没有问题。
请教这个问题如何解决。也希望大家多讨论关于office automation的问题。特别是如何把office和Web结合。
把office的自动化服务使用在Web中。