Help / Developing an application or website / Controls, windows and pages / Controls: Available types / Rich Text Area control
  • Filling a TreeView Table with the tree structure of folders found in an Outlook database
OutlookStartSession (Example)
Filling a TreeView Table with the tree structure of folders found in an Outlook database
WINDEVUser code (UMC)Stored procedures
The following code is used to fill a treeview table with all the folders found in an Outlook database.
// Declare the variables
// Identifier of the session
SessionID is int
// List of folders
FolderList is string
// Name of each folder
FolderName is string
// Index of each folder
FolderSubscript is int = 1
// Beginning of name for each folder
FolderPart1 is string
// End of name for each folder
FolderPart2 is string
// Number of emails found in each folder
NbEmails is int
// Start the session
SessionID = OutlookStartSession("")
// Error occurred?
IF SessionID = 0 THEN
Error("Error while starting the session", ErrorInfo())
// List of folders
FolderList = EmailListFolder(SessionID, LstFolderAll)
// Extract the 1st listed folder
FolderName = ExtractString(FolderList, FolderSubscript, CR)
// Handle the folders
WHILE FolderName <> EOT
// Change the current folder
EmailChangeFolder(SessionID, FolderName)
// Number of emails found in the current folder
NbEmails = EmailNbMessage(SessionID)
// Extract the different parts from the folder name
FolderPart2 = ExtractString(FolderName, 1, "\", FromEnd)
FolderPart1 = ExtractString(FolderName, 1, "\" + ...
// 1st folder to add into the table?
IF FolderSubscript = 1 _OR_ NOT Contains(FolderName,"\") THEN
TableAddChild(TVT_FolderTable, Null, ...
FolderPart2, NbEmails, FolderName)
// Replace the "\" by TAB
// at the beginning of folder name
FolderPart1 = Replace(FolderPart1, "\", TAB)
// Add the following folders
TableAddChild(TVT_FolderTable, FolderPart1, ...
FolderPart2, NbEmails, FolderName)
// Increment the subscript of the folder
FolderSubscript ++
// Extract the other listed folders
FolderName = ExtractString(FolderList, FolderSubscript, CR)
// Close the session
IF SessionID <> 0 THEN
SessionID = 0
Minimum version required
  • Version 11
This page is also available for…
Click [Add] to post a comment

Last update: 04/06/2023

Send a report | Local help