Cancel Sending an Item via VBScript

D

dch3

Is it possible to cancel sending an item via VBScript behind a form?

I would like to be able to abort sending a form if field validation fails
and would prefer to have all relevant code reside behide the form to avoid
having to install code under the ThisOutlookSession module on each machine
running Outlook.
 
S

Sue Mosher [MVP-Outlook]

Sure:

Function Item_Send()
If <your validation criteria are not met> Then
Item_Send = False
End If
End Function

Remember, though, that custom message forms may not be a good solution if you're going to be sending these messages to recipients external to your Exchange organization.
 
D

dch3

The custom form is only for use when composing the message. I'm using
..MessageClass = IPM.Note in the Send event and have the 'Send form definition
with message' = No to keep the form internal.
 
S

Sue Mosher [MVP-Outlook]

I think you'll see, if you try it, that setting .MessageClass to IPM.Note in the Item_Send event handler won't make any difference. An external recipient will still get a Winmail.dat file and a non-Outlook recipient still won't be able to read recipients. You'd have to use CDO to delete a key property related to the form in the outbound message or use your Item_Send code to create a new message and discard the old.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54
 
D

dch3

I've sent the message to both my hotmail.com (view message via web browser)
and aol.com (download message to Outlook client) accounts as well as to a
friend of mine on an external Exchange server (message sent Exchange to
Exchange & viewed in Outlook) that is in no way connected to ours. None of
the messages showed any attachments and all of them displayed the message
correctly as a regular mail message. The recipients were displayed in all of
them. I had Scott send me a screen print of the message to confirm everthing.
The only thing that I haven't done is send the message Exchange to GroupWise
to test that.

David H
 
S

Sue Mosher [MVP-Outlook]

The results indicate that your Exchange server, which you didn't mention before, is stripping the TNEF content from the outgoing message.
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54
 

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