Apple Script stopped working in Outlook for Mac since update

Outlook for Mac latest version (Version 16.96.2 (25042730)). Mac OS latest version.

I have a script to create mails for stuff I send once a month. It stopped working this morning and I cannot figure out why it does not work. Spend about an hour.
Has MS depreciated Apple Script? To force us to use some of their stuff? I hope not!

The error message is:
Microsoft Outlook got an error: Can’t get imap account 1 whose name = “xx@xx-xx.com”. Invalid index.
Any ideas?
Here is the script:

use AppleScript version "2.5" --(10.11) or later
use framework "Foundation"
use scripting additions

on previousMonth(anyDate)
	return (month of (anyDate - (anyDate's day) * days))
end previousMonth

-- Get the number of the previous month as text, with a leading zero if applicable.

set lastMonth to text 2 thru 3 of ((100 + previousMonth(current date)) as text)

tell application "Microsoft Outlook"
	set theAccount to the first imap account whose name is "xx@xx-xx.com" --change as needed
	set theContent to "Dear xx,
<br> <br>
Email text here …………...
" --change as needed
	set theMessage to make new outgoing message with properties {account:theAccount, subject:("xx xx " & lastMonth), content:theContent} -- change content > plain text content if you want that
	make new recipient with properties {email address:{name:"xx", address:"x.x@x.com"}} at end of to recipients of theMessage --change name + address as needed
	open theMessage

end tell

Thanks!

Are you running your outlook in old mode or new mode?

New mode. Old mode got to buggy with the IMAP accounts, but new mode has better bugs so to speak. Sorry could have mentioned it.

New mode is unscriptable

They must be kidding, and they charge you money for it. However, I have other scripts that work no problem. So, are you sure? Why do you say this?

If you research this forum, you will see many complaints of most scripting functions not working in the new Outlook. It is a widely known problem, and Microsoft keeps hinting that they are working on it, but nothing comes of it.

Thanks. I had seen that but since all my other scripts still work I figured this is an error in the script. and since account and IMAP are in the directory for Apple Script, that strengthened my believe.