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


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 If
End 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.


This is a known issue in Outlook.


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. 

Article ID: 3179549 - Last Review: Aug 25, 2016 - Revision: 1