tell application "Microsoft Outlook" set newMessage to make new outgoing message with properties {subject:"Hooray for automation"} make new recipient at newMessage with properties {email address:{name:"Jim Shank", address:"jim.shank@example.com"}} open newMessage end tell
After hours of searching, I finally came across this fantastic example from Bobby Kansara at Microsoft. Thanks to the early adopters and beta testers.
Nice - thanks. I was testing with SEND instead of Open and it just puts the message in the drafts folder. Seems like a bug to me.
ReplyDeleteI agree, it does seem bugged. I always need to add a bit of text before sending the message so hadn't tried a fully automated send yet.
ReplyDeleteI am trying to add bcc to an existing window before sending. I had a script in Entourage that used to work by pressing ^B, but the same does not work here. If I use your script I can create a new window with bcc, but I am unable to set the current window to add bcc, if you can help it would be great ...
ReplyDeleteI'll give it a try and see if mine won't send.
ReplyDeleteHow do you get Outlook to send?? This script creates a message but I'd like to automatically send, too.
ReplyDeleteThanks!
The docs say "send newMessage". Can anyone confirm?
ReplyDeleteChanges in the Applescript dictionary from Entourage to Outlook has messed me up, too. I HAD a script which parses a list of items such as name, project, email and name of an attachment file and created outgoing messages in the draft box (as it was called). After looking them over for correctness, I selected and dragged them into the outbox and away they went.
ReplyDeleteI am getting type errors that I cannot seem to fix or even isolate. My working Entourage make message line was:
make new outgoing message at draftbox with properties {recipient:theRecipient, subject:theSubject, content:messageBody, has html:true, attachment:theFilePath}
which I changed to:
make new outgoing message at drafts with properties {recipient:theRecipient, subject:theSubject, content:messageBody, has html:true, attachment:theFilePath}
and am getting the error:
Can’t make "email@email.com" into type recipient.
In trying to break the statement apart, I've tried a number of iterations. The latest may give someone a clue what's going on that I'm not seeing:
set theAccount to pop account "Evaluator"
tell drafts of theAccount
set theMsg to make new outgoing message with properties {subject:"subject", content:"body", account:theAccount}
end tell
make new attachment at theMsg with properties {name:theFilePath}
make new content at theMsg with properties {content:messageBody, has html:true}
make new to recipient at theMsg with properties {email address:{name:FirstName, address:theRecipient}, type:to recipient type}
send theMsg
First 5 lines execute fine. The next line fails with:
Can’t make missing value into type location specifier.
Interestingly, any of the 3 'make' lines get the same error, when I reorder them to execute as line 6. That doesn't make sense to me, but maybe to someone reading this?
Actually, I can't even get this to work:
ReplyDeleteset theAccount to pop account "Evaluator"
tell drafts of theAccount
set theMsg to make new outgoing message with properties {subject:"subject", content:"body", account:theAccount}
end tell
send theMsg
I get:
Can’t make missing value into type message.
This script doesn't work in Lion 10.7.2. I get the AppleScript error:
ReplyDeleteMicrosoft Outlook got an error: Can’t make class outgoing message.
Something's become broken there?
I can't believe it! I got Microsoft Office to send!
ReplyDeleteSpecs are: MacOS 10.7.3, Microsoft Outlook for Mac 14.0.0 connected to an Exchange server.
Code is:
tell application "Microsoft Outlook"
set OutgoingEmail to make new outgoing message with properties {subject:"subject", content:"body"}
make new recipient at OutgoingEmail with properties {email address:{name:"", address:"me@test.com"}}
send message id (id of OutgoingEmail)
end tell
Note: Sometimes the email sends but it also stays in Drafts. It seemed to only happen during testing. Haven't used this enough to know if it happens during production.
Rob Stokes
Outlook seems to be ignoring returns in the text string of my message content
ReplyDeleteE.g,
set myContent to "line one" & return & "line two" as string
...
set OutgoingEmail to make new outgoing message with properties {subject:”subject”, content:myContent}
the resulting email message content is line oneline two (running the two paragraphs into one).
Ideas?
Thanks
Hi Jim, I'm wondering if you've figured out how to get "Split Recipients" applescript working in Outlook 2011? I tried it and get an error, but don't know code well enough to figure out what needs changing. I can send you the applescript file if you like. Many thanks.
ReplyDeleteIt proved to be Very helpful to me and I am sure to all the commentators here! msn hotmail
ReplyDelete