I’ve got a super old AppleScript to get the mailboxes of Outlook:
global AllFolders
set AllFolders to {}
global ContainerName
set ContainerName to ""
tell application "/Applications/Microsoft Outlook.app"
set allMailFolders to get mail folders
repeat with currentFolder in allMailFolders
set FolderName to name of currentFolder
set PathSoFar to ""
if FolderName is not missing value and (container of currentFolder is not missing value or account of currentFolder is not missing value) then
set ContainerName to ":::"
set theContainer to currentFolder
repeat while ContainerName is not ""
set ContainerName to ""
try
set theContainer to container of theContainer
set ContainerName to name of theContainer
if ContainerName is missing value then
set theAccount to account of theContainer
if theAccount is not missing value then
set AccountName to name of theAccount
set PathSoFar to (AccountName) & ":::" & PathSoFar
end if
else
set PathSoFar to (ContainerName) & ":::" & PathSoFar
end if
end try
end repeat
set end of AllFolders to {PathSoFar & ":::" & (FolderName)}
end if
end repeat
return AllFolders
end tell
The script works fine and for me it was never slow. Today I did some troubleshooting over Zoom for a user of my app. He has about 500 mailboxes and the script took over a minute to run. Does anyone have an idea how to speed up the script?