You can get all folders based in a criteria, this is useful because it can be queried by a SearchFilter. In this case I’m only get Folders that have at least 1 message because operator is SearchFilter.IsGreaterThan
view.Traversal = FolderTraversal.Deep;
As always you have to use an Object type of ExchangeService(), see the GetBinding() Method
FolderView view = new FolderView(10)
PropertySet = new PropertySet
}; // Identify the properties to return in the results set.
// Return only folders that contain items.
SearchFilter searchFilter = new SearchFilter.IsGreaterThan
view.Traversal = FolderTraversal.Deep; // Send the request to search the mailbox and get the results.
FindFoldersResults findFolderResults = service.FindFolders
foreach (Folder myFolder in findFolderResults.Folders)
// Go get myFolder.Id, MyFolder.DisplayName etc…
} // Determine whether there are more folders to return.
// Make recursive calls with offsets set for the FolderView