首页 文章

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

提问于
浏览
0

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

我将收到更多电子邮件,表明其他与会者(每封电子邮件一个)以及应将新与会者添加到哪个活动 .

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

我需要访问具有相同主题的现有事件并且 add more attendees to the event.

现在我正在尝试使用此代码实现此目的:

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,所以我认为我的“set existingEvent to”是错误的 .

1 回答

  • 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来完成我的任务 .

相关问题