How to set any form as the default form for a folder in Outlook 2000 (249199)



The information in this article applies to:

  • Microsoft Outlook 2000

This article was previously published under Q249199
For a Microsoft Outlook 97 version of this article, see 266331.
For a Microsoft Outlook 98 version of this article, see 266329.

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 either an e-mail message form or a Microsoft Office document 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. This also means that you cannot set other types of forms, such as Office document forms, as the default form for a folder.

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 or an Office document 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, an Office document form that is based on Word 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: For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site: To create, and then publish a form:
  1. Open the public folder you want to set a default form for.
  2. Open a Word Office form. To do this, on the File menu, point to New, and then click Office Document. Double-click the Microsoft Word Document icon. When prompted to either send or post the document, click Post the document in this folder, and then click OK.
  3. Publish the Word Office form to the public folder. 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 WordDoc 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 "Intermediate" Form

  1. On the File menu, point to New, and then click Post in This Folder.
  2. On the Tools menu, point to Forms, and then click Design This Form.
  3. On the Form menu, click View Code. This opens the Script Editor.
  4. 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 "WordDoc" Word Office Form.
       Set oNewItem = colItems.Add("IPM.Document.Word.Document.8.WordDoc")
    
       ' 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
    					
  5. In the Script Editor, on the File menu, click Close.
  6. In the form, on the Tools menu, point to Forms, and then click Publish Form As.
  7. Confirm that Look in is set to Outlook Folders, and that the public folder is selected.
  8. In the Display name box, type a name for the form, and then click Publish.
  9. On the File menu, click Close. When prompted to save changes, click No so that a new item is not created.

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 an Office document form that is based on Word instead of the standard form for the folder.

NOTE: The Outlook object model does not allow you to use the Items.Add method to directly add an Office document item to a folder. You must publish the Office document form that is based on Word, and then specify a custom Message Class when you use the Items.Add method.

REFERENCES

For additional information about how to use the Outlook object model to programmatically start new items, and how to use the Items.Add method, click the article number below to view the article in the Microsoft Knowledge Base:

208520 OL2000: Programming Examples for Referencing Items and Folders

For additional information about available resources and answersto commonly asked questions about Outlook solutions, click the article number below to view the article in the Microsoft Knowledge Base:

146636 OL2000: Questions About Custom Forms and Outlook Solutions


Modification Type:MinorLast Reviewed:10/7/2004
Keywords:kbhowto kbProgramming kbusage KB249199