📄 olmainf.pas
字号:
{-----------------------------------------------------------------------------
Unit Name: OlMainF
Author: hubdog
Purpose:
History: 注意本程序只能在Office 2000中文版中才能运行
-----------------------------------------------------------------------------}
unit OlMainF;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
OpenBtn: TButton;
ContactsList: TListBox;
MapiList: TListBox;
PersonalList: TListBox;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
procedure OpenBtnClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses ComObj;
{$R *.DFM}
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('个人文件夹');
{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('联系人');
{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;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -