Has anyone struck problems with scripting attachments in Outlook recently? This code has suddenly stopped working:
set pathToPDFHFS to "Macintosh SSD:Users:shane:Desktop:edit-comparison.php.html.pdf" -- whatever
set theAttachment to pathToPDFHFS as «class furl»
set emailSubject to "Subject"
set emailContents to "Blah"
tell application id "com.microsoft.Outlook"
set theMessage to make new outgoing message at drafts with properties {subject:emailSubject}
tell theMessage
set content to emailContents
make new attachment with properties {file:theAttachment}
--> Error while saving the changed record property.
end tell
end tell
The attachment is never added. I’ve tried using alias, HFS path and POSIX path, with no difference. If I use the Explorer to examine an existing attachment, the file property shows missing value.
Maybe a stupid reply…
but I hope you are not using the NEW outlook because there is still no AppleScript implemented!
I hope Microsoft doesn’t drop scripting
have you tried using a different file name?
When I was still using Outlook (on Windows), some file extensions were blocked. Maybe Outlook identifies the name “edit-comparison.php.html.pdf” as php. Even on iOS, I often have trouble with file recognition if there is more than one dot in the file name.
Did you try to point the mail account before adding the attachment?
I’m used to script Office apps and I’m always surprised to see how some silly things can change it all…
This is really not correct. I’m running New Outlook for Mac (NOM), and it does have a scripting dictionary. The issue with Outlook is that the dictionary has been stagnant since shortly after the 2011 release. For example, while it supports on-prem exchange accounts, there’s no 365 account type, so if you’re looking to script things associated with a 365 account, that’s going to fail.
from discussions with some folks on the outlook team, because AppleScript is a Mac-only tech, there is a certain resistance to spending any real resources on it. If this is important to you, then you need, need to use the feedback option within outlook, (uservoice is going away) to state how updated and current AppleScript support is critical for your use of the product.
Otherwise, you’re going to be stuck with the only automation option being their javascript or whatever widgets that will be about useless in doing anything outside of 365. If that’s the case, then your on-machine automation outside of Office will cease to exist unless the Outlook team feels like creating a shortcut for it.
Thanks for this info!
I saw that there was a scripting dictionary… but using it with the same applescript code it let’s New outlook hang.
I will follow your proposal to give feedback within outlook to reconsider updating the applescript support for NOM.