使用AppleScript修改/更改Outlook日历事件

时间:2018-07-19 18:38:49

标签: macos outlook applescript office365

我有一个脚本,可以从电子邮件中的内容(也可以从Outlook)创建Outlook日历事件。电子邮件包含事件的名称,日期/时间和单个与会者的信息。 首先使用电子邮件中指定的一位与会者创建活动。

我将收到更多电子邮件,指示其他与会者(每封电子邮件一个),以及应将新与会者添加到的事件。

现在,我的脚本能够创建日历事件(包括位置,主题,开始/结束时间,内容和提醒时间),并向该事件添加一个必需的参与者,然后将该事件发送给参与者。

我需要访问具有相同主题的现有活动,并为活动添加更多参与者。

现在我正在尝试通过以下代码实现这一目标:

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

我没有收到错误,但是我的代码只是退出了try / error,所以我认为我的“将existingEvent设置为”是错误的。

1 个答案:

答案 0 :(得分:0)

我可以使用此代码添加与会者

    --Create/add attendee for calendar message invite
make new required attendee at msgToSend with properties {email address:{name:"First Last", address:"first.last@email.com"}}

msgToSend是要发送的新日历事件。此事件是由

创建的
    --Create calendar message invite
    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}

我无法确定如何使用AppleScript检查和修改现有事件。我改用Microsoft Flow来完成任务。

相关问题