ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

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
EmailListFolder (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
// 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())
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 index 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

Last update: 03/18/2025

Send a report | Local help