My application archives emails on the Mac. I get the mailboxes from AppleMail with AppleScript. Each mailbox - except for Gmail - has a corresponding folderitem on the hard disk. The mailbox “@read” for the Macsend account has the folderitem
/Users/beatrixwillius\ 1/Library/Mail/V5/76311AE0-D7FB-4321-910E-3ECABA2B1FE6/@read.mbox
Because of the wonderful security the app needs full hard disk access.
For one user some but not all mailboxes are missing. I have traced this back to a folderitem.child call. The code first finds the path of the mailbox which is the part from “/Users” to “FE6”. Then it moves down level by level by doing folderitem.child (error handling omitted):
dim theResult as FolderItem = currentAccountDirectory
dim thePath(-1) as String = MailboxPath.Split(globals.MailboxDivider)
thePath.RemoveRowAt(0) 'don't need the account name itself
for currentPath as Integer = 0 to thePath.LastRowIndex
dim ChildPath as String = thePath(currentPath) + ".mbox"
theResult = theResult.Child(ChildPath)
next
I added some logging to the code and got the following back:
2020-12-08 11:58:19 emlxIterator.Constructor Mailboxes::::Hardware:::Canon:::Canon_8400F
2020-12-08 11:58:19 emlxIterator.Constructor current account directory: /Users/mark/Library/Mail/V6/87D8C005-8AF9-4467-B6E5-6D25C7056959
2020-12-08 11:58:19 emlxIterator.getMailboxFolderitem path: Computer
2020-12-08 11:58:19 emlxIterator.getMailboxFolderitem path folderitem: /Users/mark/Library/Mail/V6/87D8C005-8AF9-4467-B6E5-6D25C7056959/Computer.mbox
2020-12-08 11:58:19 emlxIterator.getMailboxFolderitem path: Hardware
2020-12-08 11:58:19 emlxIterator.getMailboxFolderitem path folderitem: /Users/mark/Library/Mail/V6/87D8C005-8AF9-4467-B6E5-6D25C7056959/Computer.mbox/Hardware.mbox
2020-12-08 11:58:19 emlxIterator.getMailboxFolderitem path: Canon
2020-12-08 11:58:19 emlxIterator.getMailboxFolderitem path: Canon_8400F
2020-12-08 11:58:19 emlxIterator.GetNumberOfObjects nothing there
Hardware exists. But the subfolder Canon does not. I had the user do a “ls -l” on the Hardware folder with the following result for c:
drwxr-xr-x@ 4 mark staff 128 Nov 12 2019 CablesToGo.mbox
drwxr-xr-x@ 8 mark staff 256 Dec 4 14:05 Canon.mbox
drwxr-xr-x@ 4 mark staff 128 Nov 12 2019 ClubMac.mbox
drwxr-xr-x@ 4 mark staff 128 Nov 12 2019 Comply.mbox
drwxr-xr-x@ 4 mark staff 128 Nov 12 2019 CompuCover.mbox
drwxr-xr-x@ 4 mark staff 128 Nov 12 2019 Computers4Sure.mbox
drwxr-xr-x@ 4 mark staff 128 Nov 12 2019 ContourDesign.mbox
drwxr-xr-x@ 4 mark staff 128 Nov 12 2019 Corsair.mbox
drwxr-xr-x@ 4 mark staff 128 Nov 12 2019 Cowin.mbox
drwxr-xr-x@ 4 mark staff 128 Jan 31 2020 CyberPower.mbox
I also made a loop for the child items with FileListMBS. The result for the items with c is:
CablesNMor.mbox
CablesToGo.mbox
Canon Pixma MG6120.mbox
ClubMac.mbox
Comply.mbox
CompuCover.mbox
Computers4Sure.mbox
ContourDesign.mbox
Corsair.mbox
Cowin.mbox
CyberPower.mbox
Does anyone have an idea what might cause this odd behaviour? Xojo 2019r3, user has Mojave.