Microsoft Outlook (To recipient) problem!

Hello, is there a special command to add a (to recipient) to a email? The CC Recipient as well as the BCC Recipient is working perfectly but when I try to add a TO Recipient, I don’t get any error message but at the end the To Recipient field is still empty. :rolleyes:

Anybody has an idea?

make new to recipient at to recipient 1 with properties {email address:{name:BLABLA_Name, address:blablabla_Mail}}
                make new cc recipient at cc recipient 1 with properties {email address:{name:"BLABLA", address:blabla}}

Thank you

Browser: Safari 537.36
Operating System: macOS 10.14

I’m puzzled. I always see the syntax using “set new_xxx at end of yyy”

Here is a script borrowed from Learn AppleScript (3rd edition) which work flawlessly:

set the_subject to "Hello there"
set the_body to "Please read the attached file:"
set the_file to choose file with prompt "Choose the file to attach:"
tell application "Mail"
	set new_message to make new outgoing message ¬
		with properties {subject:the_subject, content:the_body, visible:true}
	tell new_message
		-- Add the recipients:
		make new to recipient ¬
			at end of to recipients ¬
			with properties {name:"Simon", address:"simon@example.net"}
		make new cc recipient ¬
			at end of cc recipients ¬
			with properties {name:"Georgia", address:"georgia@example.net"}
		-- Add the attachment:
		make new attachment ¬
			at end of last paragraph of content ¬
			with properties {file name:the_file}
	end tell
end tell

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) jeudi 30 janvier 2020 18:25:28

To recipient field is still empty :frowning:

Actually it’s in Microsoft Outlook, not Mail… Maybe it works quite differently

Oops, I read the question but missed the title.

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) jeudi 30 janvier 2020 18:53:39

– Hi, this is how I generally do it. The new message is created, then items are added to it.


tell application "Microsoft Outlook"
	set theAccount to exchange account "AccountName"
	
	set theRecipient to "abc@abc.com"
	
	set theSubject to "Email Subject"
	set theContent to "Hi, this is the email body."
	
	
	tell folder "_Outbox" of theAccount -- fake outbox
		set newMessage to make new outgoing message with properties {subject:theSubject, content:theContent & return & return}
		
		tell newMessage
			--make new attachment with properties {file:theAttachment as alias} -- attachment example
			
			make new to recipient with properties {email address:{name:"", address:theRecipient}}
						
		end tell
		open newMessage
	end tell
end tell

Browser: Safari 605.1.15
Operating System: macOS 10.14

Thank you, it made me realize that my mistake was that the “open MyMessage” command was coming before adding the to recipient stuff… By putting it at the end of my tell block, everything is ok.

You don’t know how it make me happy just that little thing!

Thanks