Working through an AppleScript to scan MailBoxes in Mail.
The mailboxes are organized as subfolder
Customers
CustomerA
CustomerB
…
repeat with theMailbox in every mailbox
set currentMailbox to theMailbox
set mailboxName to the name of currentMailbox
try
set messages_list to every message of mailbox mailboxName
results in
"–> error number -1728 from mailbox “CustomerA”
It works for mailboxes that are not subfolders, so I assume that the fact that the mailbox is a subordinate requires another way to refer to it.