• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
New Recipient in Outlook 2011
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

New Recipient in Outlook 2011


  • Subject: New Recipient in Outlook 2011
  • From: Dave <email@hidden>
  • Date: Thu, 15 Oct 2015 14:25:25 +0100

Hi,

I’m trying to add a recipient to a draft message in Outlook 2011 using AppleScript. I open the message in the drafts folder and it’s the front window when the following script runs:

on run
	set myRemoveAddress to "email@hidden"
	set myAddAddress to "email@hidden"
	set myEmailAddressList to {}

	tell application id "com.microsoft.Outlook"
		activate

		set myWindow to the front window
		if class of myWindow is not draft window then
			return "Error - Not Draft Window"
		end if

		save myWindow

		set myObjectID to the id of (object of myWindow)


— Fails on this Line with "error "Microsoft Outlook got an error: AppleEvent handler failed." number -10000”  ?????????????????????????????????????????
	make new recipient at (message id myObjectID) with properties {email address:{name:"Fred Bloggs", address:myAddAddress}}

		repeat with myRecipient in recipients of message id myObjectID
			set myEmailAddress to email address of myRecipient
			set myEmailAddressString to address of myEmailAddress as string
			copy myEmailAddressString to end of myEmailAddressList
		end repeat

		set myRecipientCount to the number of items in myEmailAddressList
		repeat with myIndex from 1 to myRecipientCount
			set myEmailAddressString to item myIndex of myEmailAddressList

			if myEmailAddressString starts with myRemoveAddress then
				delete recipient myIndex of message id myObjectID
			end if
		end repeat

		return "OK"
	end tell
end run

I get an error on the make new recipient statement, any ideas on how to make this work would be greatly appreciated.

Thanks a lot.

All the Best
Dave







 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden


  • Follow-Ups:
    • Re: New Recipient in Outlook 2011
      • From: Christopher Stone <email@hidden>
References: 
 >What is the essential difference between ASOC on Script Editor and Xcode based ASOC app (From: Takaaki Naganoya <email@hidden>)

  • Prev by Date: Re: What is the essential difference between ASOC on Script Editor and Xcode based ASOC app
  • Next by Date: Delete Custom Document Property in Word 2011
  • Previous by thread: Re: What is the essential difference between ASOC on Script Editor and Xcode based ASOC app
  • Next by thread: Re: New Recipient in Outlook 2011
  • Index(es):
    • Date
    • Thread