Item_Send event is not firing

M

Midwest Muskie

We are using Outlook 2007, SP1 with Exchange 2003, SP2.

We are using a form to route project opening orders for our company. There
are several users that are having the same problem with the form. The
troubleshooting I've done points to the Item_Send event not firing. I'm at
my wits end to try to figure out why the event doesn't fire on some machines.
I've checked macro security settings, and even re-installed Office. Here is
the code I'm using. Any help would be greatly appreciated.

Mike

Option Explicit

'
' Send only to the first person in the To field,
' Save other people in the To field into the RouteTo field.
'
Function Item_Send()
' Stop
Dim recipient
Dim i
Dim bDelete
Dim prpRouteTo

i = InStr(Item.To, ";")
If i Then
Set prpRouteTo = Item.UserProperties("RouteTo")
prpRouteTo.Value = Mid(Item.To, i + 1)
' if name "ProjectApproval isn't found on the routing list then add
it.
If InStr(UCase(prpRouteTo.Value), UCase("ProjectApproval")) = 0 Then
prpRouteTo.Value = prpRouteTo.Value & ";
(e-mail address removed)"

End If
bDelete = False
i = 1
While i <= Item.Recipients.Count
If Recipients.Item(i).Type = 1 Then ' olTo
If bDelete Then
Recipients.Item(i).Delete
Else
i = i + 1
bDelete = True
End If
Else
i = i + 1
End If
Wend
Else
Set prpRouteTo = Item.UserProperties("RouteTo")

' if name "ProjectApproval isn't found on the routing list then add
it.
If InStr(UCase(prpRouteTo.Value), UCase("ProjectApproval")) = 0 Then
prpRouteTo.Value = "(e-mail address removed)"
Else
prpRouteTo.Value = ""
End If
End If
' BCC to project approval unless the message is going To: that address.
If UCase(Item.To) <> UCase("(e-mail address removed)") Then
set recipient = Recipients.Add ("(e-mail address removed)")
recipient.Type = 3
' Item.cc = "(e-mail address removed)"
recipient.resolve
End If
End Function

'
' Route message to people in the RouteTo field
'
Function Item_CustomAction(ByVal Action, ByVal NewItem)
' Stop

Dim prpRouteTo
Dim i
Select Case Action.Name
Case "Route"
Set prpRouteTo = NewItem.UserProperties("RouteTo")
If prpRouteTo.Value <> "" Then
Item_CustomAction = True
NewItem.To = prpRouteTo.Value
prpRouteTo.Value = ""
Else
Item_CustomAction = False
End If
Case Else
Item_CustomAction = True
End Select
End Function
 
M

Midwest Muskie

Just want to clarify that this is a form that has been published to the
Organizational Forms Library.

Thanks,
Mike
 
M

Midwest Muskie

The item_send event is not triggering when the user sends the message, but
the Route custom action is not kicking off when the user clicks the "Route"
button either. It appears that the script is not running at all for those
having problems. I have tried setting the macro security level to the lowest
setting, but that makes no difference. Is there someplace to configure
allowing this script to run??

This form is published to our Organizational Forms Library.

Thanks again,
Mike
 
S

Sue Mosher [MVP]

Macro security affects VBA only and has nothing to do with code on custom
forms. Are the problem users opening items in other users' mailboxes? If so,
see http://outlookcode.com/article.aspx?id=67 for information on a necessary
registry change.

Has your troubleshooting included adding some MsgBox statements to Item_Send
to see if any of it is running?
 
M

Midwest Muskie

Sue,

Thanks for your comments! The problem users are not opening items in other
users' mailboxes. My Has troubleshooting has included adding some MsgBox
statements to Item_Send to see if any of it is running. I included a MsgBox
at the very beginning of the Item_Send event portion of the script, and it
just isn't kicking off at that event. The problem appears to be limited to a
few users. I have access to their mailboxes from both Office 2003, and 2007
test machines. The form runs fine from both versions. This leads me to
think there is something about their local settings (office settings,
windows, etc.???). One of the users seemed to start experiencing the problem
after he was upgraded to Office 2007. I've tried the Office 2007
diagnostics, and even did a complete uninstall and reinstall of Office 2007.
I have not tried reinstalling Office 2003, however.

Mike
 
M

Midwest Muskie

Just another piece of info. I've also tried clearing the forms cache on the
problem machines to no effect.

Thanks again for your help!

Mike
 
S

Sue Mosher [MVP]

Is other code on the form running or is the problem just with Item_Send? Is
there a possibility that the form has one-offed for those problem users?
Check the MessageClass property to be sure.

Is there a possibility that these users have access to more than one version
of the form, published in different places? If you're incrementing the
version number on the (Properties) page when you publish each new version,
it should be easy enough to tell.
 
M

Midwest Muskie

The MessageClass is IPM.Note. The form is published to the Organizational
Forms Library (the only place it's published) so I didn't think it could be a
one-offed. I'm not sure how to check the message class of a form they might
be using on their own machine. As I've mentioned, I've cleared the forms
cache on their machine and downloaded a new form from the Organizational
Forms Library, but couldn't run that one either.

The MsgBoxes I've used seem to indicate that the script associated with the
form just never kicks off. They can download a new form, fill it out, send
it (just using the Send button, not the Route button associated with the
form). I receive the form, and the script is still with the form, and the
"Route" custom action works. If I send them the form, the script is with the
form, but clicking the "Route" custom action from their machine does nothing.

Here is the code the form is using:

Option Explicit
'
' Send only to the first person in the To field,
' Save other people in the To field into the RouteTo field.
'
Function Item_Send()
' Stop
Dim recipient
Dim i
Dim bDelete
Dim prpRouteTo
i = InStr(Item.To, ";")
If i Then
Set prpRouteTo = Item.UserProperties("RouteTo")
prpRouteTo.Value = Mid(Item.To, i + 1)
' if name "ProjectApproval isn't found on the routing list then add
it.
If InStr(UCase(prpRouteTo.Value), UCase("ProjectApproval")) = 0 Then
prpRouteTo.Value = prpRouteTo.Value & ";
(e-mail address removed)"
End If
bDelete = False
i = 1
While i <= Item.Recipients.Count
If Recipients.Item(i).Type = 1 Then ' olTo
If bDelete Then
Recipients.Item(i).Delete
Else
i = i + 1
bDelete = True
End If
Else
i = i + 1
End If
Wend
Else
Set prpRouteTo = Item.UserProperties("RouteTo")
' if name "ProjectApproval isn't found on the routing list then add
it.
If InStr(UCase(prpRouteTo.Value), UCase("ProjectApproval")) = 0 Then
prpRouteTo.Value = "(e-mail address removed)"
Else
prpRouteTo.Value = ""
End If
End If
' BCC to project approval unless the message is going To: that address.
If UCase(Item.To) <> UCase("(e-mail address removed)") Then
set recipient = Recipients.Add ("(e-mail address removed)")
recipient.Type = 3
' Item.cc = "(e-mail address removed)"
recipient.resolve
End If
End Function

'
' Route message to people in the RouteTo field
'
Function Item_CustomAction(ByVal Action, ByVal NewItem)
' Stop
Dim prpRouteTo
Dim i
Select Case Action.Name
Case "Route"
Set prpRouteTo = NewItem.UserProperties("RouteTo")
If prpRouteTo.Value <> "" Then
Item_CustomAction = True
NewItem.To = prpRouteTo.Value
prpRouteTo.Value = ""
Else
Item_CustomAction = False
End If
Case Else
Item_CustomAction = True
End Select
End Function


Thanks!
Mike
 
S

Sue Mosher [MVP]

If it's IPM.Note and not something like IPM.Note.MyForm, that indicates that
the form has one-offed and will no longer run code.

On the (Actions) page of the form design, is the Route action set up to use
the published form? If not, that needs to be corrected and the form
republished.

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

Sue Mosher [MVP]

That eliminates one possible source of one-offing, but there are many
others; see http://www.outlookcode.com/article.aspx?id=34. I would check in
particular to make sure that each custom field is present in the form design
on the "User properties in item" list not just "User properties in folder."
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54
 
M

Midwest Muskie

Come comments\questions related to the One-off Forms section of the article
you referred me to:

1. I am not saving the definition with the published form.
2. It appears that a form that one of the problem mailboxes initiated is 23
KB at the first recipient's Inbox. One that a non-problem mailbox initates
is only 3 KB at the first recipient's Inbox. So it does appear to be growing.
3. In the Organizational Forms Library the Message Class is
"IPM.Note.Routing - Project Approval Routing". How can I tell if the Message
Class has reverted to IPM.Note on the problem machine?
4. The only Custom Field is RouteTo and is listed under "User defined
fields in this item". Essentially all the form is is an email that includes
a default message body and the code used to route it. The users open the
form, edit the body, add attachment(s), and the full routing in the To field.
Then they send it. The script places the first recipient in the list in the
To field, and the rest of the recipients in the "RouteTo custom field. The
process continues on through the routing list untill the RouteTo field is
empty.

What troubleshooting steps can I perform on the problem machine to eliminate
the possibility of one-offing?

Thanks for your continued help on this!! I have really been butting my head
against the wall on this one!
 
S

Sue Mosher [MVP]

3) Add the Message Class field to the current view on that machine or use a
tool like Outlook Spy or MFCMAPI.exe or write your own VBA routine to check
the value of an item's MessageClass property. Didn't you already do that,
before you reported that the class was IPM.Note?

Have you checked the form version number on the problem machines? You are
incrementing the version number before publishing each version, right?

On the problem machines, does code on other forms work? Create a new form if
necessary to test.

Have you tried to repair (not reinstall) Outlook?

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

Midwest Muskie

Sue,

I added the Message Class field to my view. The Message Class of the routed
message from the problem machine is correct (same as published form).

I have not been incrementing the version numbers because I haven't made any
changes to the form. If I cleared the forms cache (which I have) doesn't
Outlook automatically download a fresh copy of the form?

We have several variations of the routed form. Only the default message
bodies are different. None of these forms work on the problem machines.

I tried a repair - made no difference. Then I did an uninstall \ reinstall
- didn't work either.

Don't give up on me :-} !!

Thanks,
Mike
 
M

Midwest Muskie

Just noticed your comment about saying that the class was IPM.Note. I think
I was looking in the wrong place for the class. The published class is
"IPM.Note.Routing - Project Approval Routing", and this is what is displayed
as the Message Class in the message routed from the problem machine.

Even though the class is correct. Nothing happens when I click the "Route"
Custom Action. It should bring up a message with the next name in the To
field and the remaining names listed in the Route To custom field that is
also displayed.

Mike
 
M

Midwest Muskie

Sorry for the delay in responding. We don't have any other forms that run
code other than the routing ones. I created a test one that had a command
button. Clicking the command button displays a message. It works on my
machine fine, but nothing happens when run on the problem machines.

We are not running on Terminal Server.

Mike
 
S

Sue Mosher [MVP]

The fact that the test form didn't work on these machines either indicates
that the problem is not with the form but with something about the Outlook
installation or some other configuration issue on those machines.
Unfortunately, there aren't any particular settings to check. I would try a
new mail profile and also, for testing purposes, disable any anti-virus
application's script-blocking capabilities.
--
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