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
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
|