Item_Send not cancelling when cancel = true

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
 
J

James Winton

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top