private static void ListSubFolders(IEWSClient client, ExchangeFolderInfo folderInfo)
{
// Create the folder in disk (same name as on IMAP server)
Console.WriteLine(folderInfo.DisplayName);
try
{
// If this folder has sub-folders, call this method recursively to get messages
ExchangeFolderInfoCollection folderInfoCollection = client.ListSubFolders(folderInfo.Uri);
foreach (ExchangeFolderInfo subfolderInfo in folderInfoCollection)
{
ListSubFolders(client, subfolderInfo);
}
}
catch (Exception)
{
}
}
// ExEnd:ListFoldersFromExchangeServer