Exchange PowerShell: How to get list of mailboxes, folders, subfolders, items in folder, foldersize programmatically?

One of my customer automated Exchange PowerShell with his .Net application. They had a requirement to enhance the functionality – to get the list of exchange mailboxes, folders and its sub folders, items in folder, foldersize. Finally it needs to be saved in .csv format.  To implement this, we used Get-Mailbox and Get-MailboxFolderStatistics Exchange cmdlets….