Outlook Read Email does not run my custom form (still)

M

Mike

Hello - I have a custom Email form in Outlook I have designed with a button
on it (with script code). I have published the form. I have unchecked the
"send form definition with item" at the property sheet.

When I click my custom button on the form it works great when I send an
Email to myself (as a test) in Outlook. But, when I send the Email from my
application it does not work. I'm thinking there is something wrong with
the code in my application and how it is launching the form. If I click
Form, Run this form then the custom button works either way (whether I send
the form directly from outlook or from my application). I am using this
code (Visual FoxPro Code):

loNameSpace = loApp.GetNameSpace("MAPI")
loOutbox = loNameSpace.GetDefaultFolder(4)
loMsg = loOutbox.Items.Add("IPM.Note.A1OLNew")
loMsg.Display

Do I need to change my code? I can't figure out why when I send it through
Outlook everything works but when I send it through my application it
doesn't. I'm thinking my code is not accessing the published forms in
Outlook. I don't know Outlook programming very well so all help would be
appreciated. Thanks.


Mike
 
M

Mike

I found out where in my code the form is being "one offed" such that the
button is not working. When I try and insert text into my custom fields it
is being one offed. This is the code I'm using (visual foxpro):

loForm = .GetInspector.ModifiedFormPages("Message")
loDD = loForm.Controls("CaseCategory")
loDD.Value = m.tcCatUse

The third line is what is causing my form to one-off. Any idea why or what
I can do about it?

Thanks,
Mike
 
S

Sue Mosher [MVP-Outlook]

Why are you setting a control value instead of the value of the property bound to that control? What is m? In any case, setting control values is not a known one-off cause. I bet it's something else.

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
M

Mike

Hi Sue - I have narrowed it down even further. I have found that if I use:

.UserProperties.Find("CaseCategory").Value = "TESTING"

then everything works and the form is not "one-offed" But, it is a dropdown
so I would like to populate the dropdown box. If I do it this way:

loForm = .GetInspector.ModifiedFormPages("Message")
loDD = loForm.Controls("CaseCategory")
loDD.PossibleValues = m.tcCatAll
loDD.Value = "Test"

the form is again "one offed" So it has something to do with setting
PossibleValues or even Values that is oneoffing the form. Lines 1 and 2
above in the code do not oneoff the form but lines 3 and 4 oneoff the form.
Is there another way to set the PossibleValues without using a GetInspector
or something else I can do? I have tested this with breakpoints and I know
the code above oneoffs the form.

Thanks,
Mike

Why are you setting a control value instead of the value of the property
bound to that control? What is m? In any case, setting control values is not
a known one-off cause. I bet it's something else.

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
M

Mike

Forgot to mention, I'm using Outlook 2002.

Mike

Mike said:
Hi Sue - I have narrowed it down even further. I have found that if I
use:

.UserProperties.Find("CaseCategory").Value = "TESTING"

then everything works and the form is not "one-offed" But, it is a
dropdown so I would like to populate the dropdown box. If I do it this
way:

loForm = .GetInspector.ModifiedFormPages("Message")
loDD = loForm.Controls("CaseCategory")
loDD.PossibleValues = m.tcCatAll
loDD.Value = "Test"

the form is again "one offed" So it has something to do with setting
PossibleValues or even Values that is oneoffing the form. Lines 1 and 2
above in the code do not oneoff the form but lines 3 and 4 oneoff the
form. Is there another way to set the PossibleValues without using a
GetInspector or something else I can do? I have tested this with
breakpoints and I know the code above oneoffs the form.

Thanks,
Mike

Why are you setting a control value instead of the value of the property
bound to that control? What is m? In any case, setting control values is
not a known one-off cause. I bet it's something else.

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
M

Mike

Sue - yes that seems to be the culprit and the AddItem is the workaround. I
don't understand the reason Microsoft Outlook does a "one-off" when using
PossibleValues. Any thoughts on why and why in general the One-Off was
implemented?

Thanks again for all your help.
Mike

Here's the culprit:

loDD.PossibleValues = m.tcCatAll

Instead, use the control's AddItem method or Row or Column property to
populate the list. See
http://www.outlookcode.com/d/formcontrols.htm#listcombo
 
S

Sue Mosher [MVP-Outlook]

It makes a change to the form definition itself, and Outlook can persist that change only by storing the form definition in the item, which is what a one-off is.

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 

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