Selecting e-mails using AppleScript - Microsoft Outlook app

Hi, Is there anyway to select e-mails using AppleScript? I want to select e-mails and run some automation scripts from outlook app. We are able to do this for Apple Mail app. Can we do the same from Outlook app? Any help appreciated!!! Thanks

Accepted Reply

tell application "Microsoft Outlook"

activate

set theMessage to {}

set theAccount to the first exchange account whose name is ""

set selected folder to sent items of theAccount



repeat with each in theArrayOfSubject

set end of theMessage to (first message of sent items of theAccount whose subject contains
each)

end repeat

set selection to theMessage

set choosenmesg to {}

set selectedMessages to selection

repeat with ea
item in selectedMessages

set end of choosenmesg to subject of eaitem

end repeat

return choosen_mesg

end tell

Replies

Yes, fairly easily. If you look at outlook’s dictionary, the code for a selected item is not radically different than in Mail.

I dont see any method for selecting an e- mail in outlook grid view

tell application "Microsoft Outlook"

activate

set theMessage to {}

set theAccount to the first exchange account whose name is ""

set selected folder to sent items of theAccount



repeat with each in theArrayOfSubject

set end of theMessage to (first message of sent items of theAccount whose subject contains
each)

end repeat

set selection to theMessage

set choosenmesg to {}

set selectedMessages to selection

repeat with ea
item in selectedMessages

set end of choosenmesg to subject of eaitem

end repeat

return choosen_mesg

end tell