PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
  • Filling a treeview table with the tree structure of folders found in an Outlook database
EmailChangeFolder (Example)
Filling a treeview table with the tree structure of folders found in an Outlook database
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())
ELSE
// 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, "\" + ...
FolderPart2)
// 1st folder to add into the table?
IF FolderSubscript = 1 THEN
TableAddChild(TVT_FolderTable, Null, ...
FolderPart2, NbEmails, FolderName)
ELSE
// 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)
END
// Increment the subscript of the folder
FolderSubscript ++
// Extract the other listed folders
FolderName = ExtractString(FolderList, FolderSubscript, CR)
END
END
Minimum version required
  • Version 11
This page is also available for…
Comments
Click [Add] to post a comment