Item_Send not cancelling when cancel = true

  • Thread starter Thread starter James Winton
  • Start date Start date
J

James Winton

Below is my vb.net code for cancelling the send event if a user property is
empty. The code processes when the Entity value is empty. I have stepped
through the code and can see it set cancel = true. the msgbox pops-up but
it still sends the message. Any ideas.

Private Sub m_olMailItem_Send(ByRef Cancel As Boolean) Handles
m_olMailItem.ItemEvents_Event_Send

Dim sEntity As String

Try

If Len(Trim(CType(m_olMailItem.UserProperties("Entity").Value, String))) = 0
Then

Cancel = True

MsgBox("Client No. must be entered before mail can be sent",
MsgBoxStyle.Information)

End If

Catch ex As System.Exception

MsgBox(ex.Message)

End Try

End Sub
 
There appears to be a problem with .NET FW 1.1 and XP PIA. I removed 1.1
and went back to 1.0 and the send event is now cancelling.

Solution provided by Randy Byrne in microsoft.public.outlook.program_addins
newsgroup.
 
Back
Top