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

Answered by Amulyakr in 617185022
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

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

Accepted Answer
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

What is the correct value for the name parameter? I keep getting Can’t get exchange account 1 whose name = "TEXT". Invalid index.

Selecting e-mails using AppleScript - Microsoft Outlook app
 
 
Q