Using MacOs Sierra, in Mail, I am trying to delete a mailbox, I am always getting the AppleEvent Handler Error 10000, no matter which mailbox, full or empty, local, or IMAP/POP.
Tell application “Mail”
delete mailbox “complaints” from account “ACME LLC”
end tell
This is not an issue with file permissions because I can rename a mailbox without problem.
FYI: I have reported several Sierra Mail / AppleScript issues to Apple, including your problem. Hopefully they are being addressed and will be fixed soon.
Have you ever tried to get properties of every mailbox ?
If you do that you will see that the property account of every mailbox is set to missing value.
At this time we must identify accounts by their id.
tell application "Mail"
properties of mailbox "aaa"
--> {account:missing value, name:"aaa", container:account id "30ACBF46-881C-40AC-B33B-500D53832270" of application "Mail", class:container, unread count:0}
properties of every mailbox whose name is "douteux"
--> {{account:missing value, name:"douteux", container:mailbox "aaa" of application "Mail", class:container, unread count:0}}
properties of mailbox "Batiactu."
--> {account:missing value, name:"Batiactu.", container:account id "30ACBF46-881C-40AC-B33B-500D53832270" of application "Mail", class:container, unread count:0}
end tell
Yvan KOENIG running Sierra 10.12.5 in French (VALLAURIS, France) jeudi 22 juin 2017 12:05:48