Outlook objects provide an MAPI namespace to access its folder collection, each folder has a unique characteristic identifier, which can be saved as data in the entryID property of the TTREENODE. The routines are as follows, and COMOBJ is added. procedure LoadFolder (ParentNode: TTreeNode; Folder: OleVariant); var i: Integer; node: TTreeNode; begin for i: = 1 to Folder.Count do begin node: = Form1.TreeView1.Items.AddChild (ParentNode, Folder.Item [ I] .name); loadFolder (Node, Folder.Item [i] .folders); end;
procedure TForm1.Button1Click (Sender: TObject); var outlook, namespace: OLEVariant; begin outlook: = CreateOleObject ( 'Outlook.Application'); namespace: = outlook.GetNameSpace ( 'MAPI'); loadFolder (nil, NameSpace.Folders) ; Outlook: = UNASSIGNED; END;
// Rock // Reprinted please keep this information