0

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...

pnuts
  • 58,317
  • 11
  • 87
  • 139

1 Answers1

2

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
mcgrailm
  • 17,469
  • 22
  • 83
  • 129
  • it throws error : "miscrosoft outlook got an error : can't get every folder." number -1728 from every folder –  Jul 09 '14 at 05:07
  • is it and exchange account, or imap or pop ? also is that the exact name – mcgrailm Jul 09 '14 at 13:35
  • well its one of four types exchange, pop, imap, ldap see update to figure it out – mcgrailm Jul 09 '14 at 13:52
  • Okie. you mean that i can try 1) ....(mail folders of (first exchange account .... 2) (mail folders of (first pop account 3) (mail folders of (first imap account etc... –  Jul 09 '14 at 13:56
  • right then you'll know which one , I'm trying to put together a bit of code that can figure it out and proceed but you may just do that and move on :) – mcgrailm Jul 09 '14 at 14:01
  • I can't seem to find a way to loop through the account types so you're just gonna to to use an if then else statement or know which type the account is – mcgrailm Jul 09 '14 at 16:34