2013-08-02 79 views
8

我目前得到了我綁在規則的腳本,這樣我可以與某些科目自動減少會議要求:我該如何默默地拒絕會議?

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.DeleteoRequest.Delete,但這並不會從我的日曆中刪除該項目。

實際上,我正在尋找的是相當於手動選擇拒絕 - >請勿發送響應對會議請求。

+0

如果他們如果參加不在乎,爲什麼在所有的反應,爲什麼不直接刪除請求? –

+0

@JoeEnos我相信我已經嘗試刪除AppointmentItem(這似乎沒有效果)和請求(它刪除了實際的電子郵件請求,但離開了我的日曆中的會議),但我會測試並仔細檢查。 – Sterno

+0

我只是雙重檢查(通過調用'oAppt.Delete'和'oRequest.Delete'),並且該項目仍在我的日曆中。 – Sterno

回答

1

而不是做oResponse.Send,儘量oResponse.Close(olDiscard)

+0

不幸的是,這似乎並沒有真正挽救我拒絕的事實,因爲它仍然出現在我的日曆中,並說「這次會議還沒有被接受。」當我徘徊在它上面時。我也試過'oResponse.Close(olSave)',這也沒用。 – Sterno

+0

我可能還有其他問題正在進行,因爲現在我發送拒絕回覆的前一個腳本似乎也沒有工作。所以也許這是行得通的,我設法做了一些阻止它執行的事情。我現在無法確認或否認此答案。其他人可以嗎? – Sterno

+0

@Sterno與你的問題相同的代碼是不工作的代碼?或者您是否修改了它,以便它不再起作用?如果是這樣,您可以使用當前版本的腳本更新問題嗎? – mclark1129

-1
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 
相關問題