10

我目前有一个绑定到规则的脚本,以便我可以自动拒绝某些主题的会议请求:

Sub AutoDeclineMeetings(oRequest As MeetingItem)

If oRequest.MessageClass <> "IPM.Schedule.Meeting.Request" Then
  Exit Sub
End If

Dim oAppt As AppointmentItem
Set oAppt = oRequest.GetAssociatedAppointment(True)

Dim oResponse
 Set oResponse = oAppt.Respond(olMeetingDeclined, True)
 oResponse.Send

End Sub

但是,这会将响应发送回会议组织者,这会不必要地向他们发送垃圾邮件,因为他们不在乎我是否参加。

如何更改此代码以使会议不显示在我的日历中并且不发送响应?我试过简单地同时调用oAppt.Deleteand oRequest.Delete,但这不会从我的日历中删除该项目。

实际上,我正在寻找的是相当于手动选择拒绝 -> 不发送会议请求的响应。

4

2 回答 2

1

与其做oResponse.Send,不如试试oResponse.Close(olDiscard)

于 2013-08-02T20:50:17.830 回答
-1

删除响应而不是发送它:

oResponse.Delete代替oResponse.Send

Sub DeclineSelected()
    Dim Session As Outlook.NameSpace
    Dim currentExplorer As Explorer
    Dim Selection As Selection
    Dim currentItem As Object
    Dim oAppt As AppointmentItem
    Dim oResponse

    Set currentExplorer = Application.ActiveExplorer
    Set Selection = currentExplorer.Selection

    'For all items selected...
    For Each currentItem In Selection
        'If it is a meeting request...
        If currentItem.MessageClass = "IPM.Schedule.Meeting.Request" Then
            Set oAppt = currentItem.GetAssociatedAppointment(True)
            If oAppt.ResponseRequested Then
                Set oResponse = oAppt.Respond(olMeetingDeclined, True, False)
                oResponse.Delete
            Else
                Set oResponse = oAppt.Respond(olMeetingDeclined, True, False)
            End If
            currentItem.Delete

        'If it is a meeting cancellation...
        ElseIf currentItem.MessageClass = "IPM.Schedule.Meeting.Canceled" Then
            Set oAppt = currentItem.GetAssociatedAppointment(True)
            If oAppt Is Nothing Then
                currentItem.Delete
            End If

    'Delete if just an email...
        ElseIf currentItem.MessageClass = "IPM.Note" Then
            currentItem.Delete
        End If

    Next
End Sub
于 2014-03-24T17:55:35.940 回答