I have a script that creates an Outlook calendar event from content in an email (also from Outlook). The email contains the name of the event, date/time, and a single attendee's information. The event is first created with the one attendee that was specified from the email.
I will receive more emails that indicate additional attendees (one per email) and which event the new attendee should be added to.
Right now my script is able to create a calendar event(with location, subject, start/end time, content, and reminder time) and add one required attendee to the event, then send the event to the attendee.
I need to get access to existing events with the same subject and add more attendees to the event.
Right now I'm trying to achieve this with this code:
tell application "Microsoft Outlook"
<...>
set textContent to paragraphs of msgContent
--Check for existing calendar event
set prevEvent to "false"
try
set existingEvent to get (calendar event of calendar whose its subject is item 9 of textContent)
tell existingEvent
make new required attendee at end of attendees with properties {email address:{name:attendeeName, address:attendeeEmail}}
end tell
open existingEvent --This is done so I can make sure it has the info I need. The I'm done it will be changed to "send meeting..."
set prevEvent to "true"
on error
log "Event does not exsist"
end try
if prevEvent = "true" then exit repeat
<...>
--Code to create a new event
set msgToSend to make new calendar event with properties {location:msgLocation, subject:msgSubject, start time:meetingDateTime, end time:endTime, content:msgNewContent, has reminder:true, reminder time:30}
<...>
end tell
I'm not getting an error but my code just exits the try/error so I think my "set existingEvent to" is wrong.