Home | Sign in | English EN
  • 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
WINDEVWEBDEV - Server codeReports and QueriesWindows MobileUser 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
// Subscript 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