List all Outlook folder and subfolder with Applescript I want to merge an Exchange account in IMAP. I moving all folder manualy in IMAP account but some emails are corrupted and all corrupted mail beging with 


  Content-type: multipart/mixed;
      boundary="XXXXXXXXXXXXXXXXX"
  
  This message is in MIME format. Since your mail reader does not understand
  this format, some or all of this message may not be legible.`
  .


So, I want to write a script that replaces the corrupted emails in the IMAP account.

The first step I would like to list the folders and then check if the X mail in folder Y is corrupted in the IMAP folder.
If this is the case, copy the mail with same date and sender from same folder in Exchange and delete it.
The first probleme is that I can't list the subdirectories. I have only first folder.

tell application "Microsoft Outlook"
    set theAccount to the first exchange account whose name is "Exchange Account"
    set folderNames to ""
    set allMailFolders to get mail folders of theAccount
    repeat with currentFolder in allMailFolders
        set folderNames to folderNames &amp; id of currentFolder &amp; " - " &amp; name of currentFolder &amp; " 
        " -- put a newline
    end repeat
end tell
Try this:

    tell application "Microsoft Outlook"
    set theAccount to the first exchange account whose name is "Exchange Account"
    set theInbox to inbox of theAccount
    set everyFolder to every folder of folder of container of theInbox
end tell


That will get you the sub folders of every folder. Hope that helps!

You can also specify the name of a folder

set theSubfolder to mail folder named "SubFolder Name"