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

Macos 使用AppleScript修改/更改Outlook日历事件,macos,outlook,applescript,office365,Macos,Outlook,Applescript,Office365,我有一个脚本,可以从电子邮件中的内容(也可以从Outlook)创建Outlook日历事件。电子邮件包含活动名称、日期/时间以及单个与会者的信息。 事件首先由电子邮件中指定的一名与会者创建 我将收到更多的电子邮件,说明其他与会者(每封电子邮件一名)以及新与会者应加入的活动 现在,我的脚本可以创建一个日历事件(包括位置、主题、开始/结束时间、内容和提醒时间),并向事件添加一个所需的与会者,然后将事件发送给该与会者 我需要访问具有相同主题的现有活动,并向活动中添加更多参与者。 现在,我正试图通过以下代

我有一个脚本,可以从电子邮件中的内容(也可以从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
告诉应用程序“Microsoft Outlook”
将textContent设置为msgContent的段落
--检查现有日历事件
将prevEvent设置为“false”
尝试
将existingEvent设置为get(日历的日历事件,其主题为textContent的第9项)
告诉存在的事件
在具有属性{电子邮件地址:{name:AttendeName,address:AttendeeMail}的与会者末尾创建新的所需与会者
结束语
打开existingEvent——这样做是为了确保它包含我需要的信息。“我完成了”将更改为“发送会议…”
将prevEvent设置为“true”
论错误
日志“事件不存在”
结束尝试
如果prevEvent=“true”,则退出并重复
--创建新事件的代码
设置msgToSend以创建具有以下属性的新日历事件{位置:msgLocation,主题:msgSubject,开始时间:meetingDateTime,结束时间:endTime,内容:msgNewContent,具有提醒:true,提醒时间:30}
结束语

我没有收到错误,但我的代码只是退出try/error,所以我认为我的“set existingEvent to”是错误的

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

    --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来完成任务。

若要跟踪当前错误,请删除“try/on error/end try”块,并替换为“if”,以测试是否找到事件。它将准确地给出错误所在的位置。通常,你应该“获得每个日历事件的…”,它会给你一个事件列表…希望只有一个成员的列表。