Sure, I will be happy to post some details and I apologize for the delay. I know its not Flow related anymore, but I will try to get a sample of my script I used. It's slightly different depending on exactly what you want to do, and I am not sure of the FTP component. My need was that I needed to crawl every email in an Exchange Online shared mailbox, read the email header metadata, create corresponding folder structures on the local server using that metadata, and save the email message in that folder, then optionally delete the email from the shared mailbox. I did it all with PowerShell running on the file server running as a scheduled task using the Exchange Web API. If you are already down this path and have a specific question let me know otherwise I will get a blog written up outlining the details as quick as I can. It also depends on what properties from Exchange you want to load.
Briefly, the first thing you need is to load the API:
[Reflection.Assembly]::LoadFile("C:\Program Files\Microsoft\Exchange\Web Services\2.2\Microsoft.Exchange.WebServices.dll")
$s = New-Object Microsoft.Exchange.WebServices.Data.ExchangeService
Then use this to get the messages of the Inbox folder:
$ServiceAcct = "<username>"
#$mailbox = "<mailbox email address>"
$s.Credentials = $creds
$s.AutodiscoverUrl($ServiceAcct, {$true})
$s.ImpersonatedUserId = New-Object Microsoft.Exchange.WebServices.Data.ImpersonatedUserId([Microsoft.Exchange.WebServices.Data.ConnectingIdType]::SmtpAddress,$Mailbox )
$Propset = new-object Microsoft.Exchange.WebServices.Data.PropertySet([Microsoft.Exchange.WebServices.Data.ItemSchema]::MimeContent, [Microsoft.Exchange.WebServices.Data.EmailMessageSchema]::Sender,[Microsoft.Exchange.WebServices.Data.ItemSchema]::Subject,[Microsoft.Exchange.WebServices.Data.ItemSchema]::DateTimeSent,[Microsoft.Exchange.WebServices.Data.EmailMessageSchema]::ToRecipients)
$InboxFolder= new-object Microsoft.Exchange.WebServices.Data.FolderId([Microsoft.Exchange.WebServices.Data.WellKnownFolderName]::Inbox,$Mailbox)
$Inbox = [Microsoft.Exchange.WebServices.Data.Folder]::Bind($s,$InboxFolder)
Write-Host 'Total Item count for Inbox:' $Inbox.TotalCount
More to follow,
Doug