Outlook attachment error

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.

Outlook 16.51 (21071101), macOS 10.15.7.

Hi Shane,

Your script is working well here:

MacOS 10.15.7 (19H1217)
Script Debugger 7.0.13 (7A125)
Outlook 16.51 (16.51.21071101)

Thanks. It still doesn’t work here (or at the client’s), though. Weird.

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 :fearful:

1 Like

Hi Shane,

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.


It’s not stupid.

Do you have a switch button like this:
If not, search for IsRunningNewOutlook or EnableNewOutlook in `com.microsoft.Outlook.plist.
The first is a boolean, the second is an integer.

Here, only the former is showing in the pref file.
Maybe it’s related to the version or the kind of app (pro, family, subscription…).

Good thoughts, but I have New Outlook off, and using a file name without other extensions makes no difference.

The really weird thing, I think, is that the fileproperty of attachments I add manually returnsmissing value`.

I’m now wondering if it might be related to the type of account.

(In case it’s not obvious, I don’t actually use Outlook except for scripting.)

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…

Not sure what you mean.

(Is your account IMAP?)

Something like:
drafts of imap account id 1
drafts of imap account "my account name"


I don’t know whether it was that or trying (and failing) to add another account, but now it works (with and without the drafts of…. Thank you!

Now to see if I can do the same elsewhere…


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.

I have Outlook for Mac
Version 16.16.27
Office 365

And appleScript works fine(ish). Are you you able to revert?