您目前已離線,請等候您的網際網路重新連線

Outlook Object Model: Setting Cancel parameter of TaskRequestItem event doesn't keep Inspector open

Symptoms
You have an Outlook add-in (COM, VSTO, or VBA) that's listening for the ItemSend event, as demonstrated in the following code sample:

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)    If vbCancel = MsgBox(TypeName(Item), vbOKCancel) Then        Cancel = True    End IfEnd Sub

When a TaskRequestItem event comes into the event handler, and you try to cancel the event by setting the parameter to True, the event is not canceled as expected. The Inspector window closes, and the task is displayed as assigned, but the task request is not sent.
Cause
This is a known issue in Outlook.
Workaround
How you work around this issue will depend on how you are using the cancel behavior in your application. If you plan to throw a dialog box to the user before the task is sent in order to give them the option to cancel the send, you will probably have to move that functionality outside the event. 
內容

文章識別碼:3179549 - 最後檢閱時間:08/25/2016 17:55:00 - 修訂: 1.0

Outlook 2016, Microsoft Outlook 2013, Microsoft Outlook 2010

  • KB3179549
意見反應