共用方式為


Outlook Forms - Troubleshooting one-off behavior

Here are some suggestions to help identify and eliminate the cause of one-off behavior when working with Outlook forms.

1. While in design mode, make sure "Send Form Definition with Item" is not checked on the "Properties" page/tab of your custom form. If it is checked, uncheck it and re-publish the form. "Send Form Definition with Item" tells Outlook that you want all items based on this form to be one-offs.

2. Make sure you are creating items based on the Published form (i.e. File --> New --> Choose Form..), and not by doing Form --> "Run This Form" while in design mode. "Run This Form" is for quick testing only and will always create a one-off item. Also, items created by double-clicking an .oft file will always be one-offs.

3. If you are still getting one-off items and don't know why, comment out all of the VBScript code in the form, republish, and confirm that your item no longer becomes a one-off. If the one-off behavior continues then it is not related to your VBScript code in the form and you should look for other Add-ins, VBA code, etc. that could be modifying the items and causing one-off behvior.

4. Assuming the one-off behavior is related to your VBScript code, start adding back parts of your code until you identify which piece of your code results in the one-off behavior. Typical causes of one-off behavior are changes to the form definition such as adding a new user-defined field or modifying the controls. You may also want to add code to the Item_PropertyChange event in your form's VBScript to see when the MessageClass changes. Something like this:

Sub Item_PropertyChange(ByVal Name)
     Select Case Name
          Case "MessageClass"
               Msgbox "MessageClass Changed"
     End Select
End Sub

5. If you identify the code that causes the item to become a one-off, examine what the code does and search for workarounds. There may be another way to do what you need to do that doesn't result in a one-off.

6. If you can't eliminate the cause of the one-off behavior due to your design requirements your last resort is to reset the MessageClass to your custom MessageClass in the Item_Write and/or Item_PropertyChange events. The custom MessageClass will tell Outlook to use the form definition from the published form and ignore the internal one-off form definition, which results in your form being "trusted" again. If you are concerned about the extra size of the items, since the one-off form definition is still stored with the item, you'll need to remove the form definition properties as described on Steve's blog here.

Additional Resources:

290657 Description of form definitions and one-off forms in Outlook 2002
https://support.microsoft.com/default.aspx?scid=kb;EN-US;290657
207913 Why Outlook displays a security warning message or does not run VBScript Code when you open an item
https://support.microsoft.com/default.aspx?scid=kb;EN-US;207913
287530 Frequently asked questions about custom forms and Outlook solutions
https://support.microsoft.com/default.aspx?scid=kb;EN-US;287530