Applescript for Outlook 2011 to iterate through all folders such as inbox etc

1.6k Views Asked by At

I want to loop throgh all the folders of outlook 2011 in MAC computer using Apple script (means just sort of automation).

i have script which throws error while running.

 tell application "Microsoft Outlook"
   set thisAccount to exchange account "Sigmaco"
   set thisFolders to mail folder of thisAccount
 end tell

 *tell application "Microsoft Outlook" to set folderList to the folders*

 repeat with nextFolder in folderList
    my ProcessFolder(nextFolder, outputFolder)
 end repeat

but the line in bold style throws error that it cannot iterate through all folders.

please help...

1

There are 1 best solutions below

6
mcgrailm On

because accounts can have the same name (assuming) you have to specify first one then drill down like this

tell application "Microsoft Outlook"
    repeat with afolder in (mail folders of (first exchange account whose name is "Sigmaco"))
        log (get name of afolder)
    end repeat
end tell

if you want to iterate through all folders of all accounts you can skip a bit of the drilling

tell application "Microsoft Outlook"

    repeat with afolder in mail folders
    -- do stuff
    end repeat
end tell