Microsoft KB Archive/292782

= OL2002: How to Set Any Form as the Default Form for a Folder =

Article ID: 292782

Article Last Modified on 5/7/2007

-

APPLIES TO


 * Microsoft Outlook 2002 Standard Edition

-



This article was previously published under Q292782





SUMMARY
In some cases, you cannot set a particular form as the default form for a folder when you use Outlook. This commonly happens when you try to use an e-mail message form as the default form for a folder. This article describes how to set a particular form as the default form for a folder by using an intermediate form.



MORE INFORMATION
Typically, Outlook folder types should contain the same type of items that are stored in that folder. For example, a Tasks folder should contain task items, a Notes folder should contain note items, and so on.

In many cases, this consistency is enforced by Outlook because you cannot set a default form for a folder unless the form type matches the folder type.

If you try to set a non-standard form as the default form for a folder by changing the When posting to this folder, use setting on the General tab in the folder Properties dialog box, you may receive the following error message:

You cannot create an item of this type in this folder.

The following sections in this article describe how to customize a form that you can set as the default form for a particular folder. This type of form is typically a Post form if you are working with a Microsoft Exchange public folder, or a Task form if you are working with one of your Task folders. When you use the sample Visual Basic Scripting Edition (VBScript) code for this form, you can start the form that you want to use as the default form for the folder, you can close the default form before it is displayed, and you can start any type of form that you want.

Before You Implement These Instructions
While this article provides the steps to set any form as the default form for a folder, Microsoft recommends that you consider the following suggestions before you implement this approach:
 * Be sure that there is not a better way to accomplish the result that you want. For example, you typically should not pre-address a mail message to a public folder, and then set that as the default form for the folder. Instead, you should use a post form.
 * If you use different types of forms in a folder by using the steps in this article, the new item that is started in the folder is saved to the default folder for that particular type of item. For example, if you start a Contact form in your Tasks folder, the contact is saved in the Contacts folder.
 * If the form that you start is an e-mail message form that is designed to be sent to someone, publish the form to the Organizational Forms Library or select the Send form definition with item option so that the recipient can access the custom form.

To Set a Non-Standard Form as the Default Form in a Folder
You can use the following example as a basis for setting a non-standard form as the default form for a folder. In this example, a mail message form is set as the default form for a public folder.

How to Create and Publish the Form
Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact a Microsoft Certified Partner or the Microsoft fee-based consulting line at (800) 936-5200. For more information about Microsoft Certified Partners, please visit the following Microsoft Web site:

https://partner.microsoft.com/global/30000104

For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site:

http://support.microsoft.com/default.aspx?scid=fh;EN-US;CNTACTMS

To create, and then publish a form:
 * 1) Open the public folder you want to set a default form for.
 * 2) Open a mail message. To do this, on the File menu, click New Mail Message.
 * 3) Publish the form. To do this, on the Tools menu, point to Form, and then click Publish Form As. Set Look in to the name of the public folder. Type Custom Message as the Display name for the form, and then click Publish. When prompted to send the form definition with the item, click No.
 * 4) On the File menu, click Close. When prompted to save changes, click No, so a new item is not created.

How to Create and Publish the &quot;Intermediate&quot; Form
 On the File menu, point to New, and then click Post in This Folder. On the Tools menu, point to Forms, and then click Design This Form. On the Form menu, click View Code. This opens the Script Editor.  Enter the following code in the Script Editor. Function Item_Open

Dim InboxItems Dim NewItem

' Reference the items in the folder. Set colItems = Application.ActiveExplorer.CurrentFolder.Items

' Add a new item to the folder, in this cased based on the ' published mail message Form. Set oNewItem = colItems.Add(&quot;IPM.Note.Custom Message&quot;)

' Display the item just created. oNewItem.Display

' Cancel the open event so the post form is not displayed. Item_Open = False

' Clean up  Set colItems = Nothing Set oNewItem = Nothing

End Function  In the Script Editor, on the File menu, click Close. In the form, on the Tools menu, point to Forms, and then click Publish Form As.</li> Confirm that Look in is set to Outlook Folders, and that the public folder is selected.</li> In the Display name box, type a name for the form, and then click Publish.</li> On the File menu, click Close. When prompted to save changes, click No so that a new item is not created.</li></ol>

How to Set the Default Form for the Folder

 * 1) Right-click the public folder and click Properties.
 * 2) Change the When posting to this folder, use setting to the name of the post form that was just published.
 * 3) Click OK.

To test the form, click the first button on the toolbar to start the new form. You see a new mail message instead of the standard form for the folder.

<div class="references_section">