Re:Outlook 2000 Automation In D6
On Thu, 05 Jun 2003 14:28:11 -0400, Chris LeFebvre
Quote
<LeFebv...@Comcast.Net> wrote:
>What I
>need to do is get a folder list and then iterate through each folder
>getting the the names of each contact list so that I can choose which
>one I want to perform an operation on.
The following procedure runs through the hierarchy of Outlook folders
and writes the folder paths to a TStrings object:
procedure ListFolders(Strings: TStrings);
procedure AddFolders(const Path: string; FolderList: _Folders);
var
i: Integer;
FolderName: string;
begin
for i := 1 to FolderList.Count do
begin
FolderName := Path + FolderList.Item(i).Name;
Strings.Add(FolderName);
AddFolders(FolderName + '\', FolderList.Item(i).Folders);
end;
end;
begin
Strings.Clear;
AddFolders('',
CoOutlookApplication.Create.GetNamespace('MAPI').Folders);
end;
You can use that as a starting point. If you're only interested in
contact folders, check the folder's DefaultItemType property - if it
is olContactItem, the folder should contain contacts and distribution
lists.
---
Yorai Aminov (TeamB)
http://develop.shorterpath.com/yorai
(TeamB cannot answer questions received via email.)