Microsoft KB Archive/266329

From BetaArchive Wiki

Article ID: 266329

Article Last Modified on 11/23/2006



APPLIES TO

  • Microsoft Outlook 98 Standard Edition



This article was previously published under Q266329


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 in which you want to set the default form.
  2. Open a new Office document form that is based on Word. To do this in Outlook:
    1. Point to New on the File menu, and then click Office Document.
    2. Double-click Microsoft Word Document.
    3. When you are prompted to either send or post the document, click Post the document in this folder, and then click OK.
  3. Publish the Word form to the public folder. To do this in Word:
    1. On the Tools menu, point to Form, and then click Publish Form As.
    2. In the Look in box, click the public folder in which you want to publish the form.
    3. In the Display name box, type WordDoc, and then click Publish.
    4. When you are prompted to send the form definition with the item, click No.
    5. On the File menu, click Close, and then click No when you are prompted to save changes so that 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 starts Script Editor.
  4. Type the following sample code in 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 case, the item is based on the
       ' published "WordDoc" Office document form that is based on Word.
       Set oNewItem = colItems.Add("IPM.Document.Word.Document.8.WordDoc")
    
       ' Display the item that you just created.
       oNewItem.Display
    
       ' Cancel the Open event so that the post form is not displayed.
       Item_Open = False
    
       ' Clean up
       Set colItems = Nothing
       Set oNewItem = Nothing
    
    End Function
                        
  5. In Script Editor, click Close on the File menu.
  6. In the form, point to Forms on the Tools menu, and then click Publish Form As.
  7. Verify that the Look in box 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, and then click No when you are prompted to save the changes so that a new item is not created.

How to Set the Default Form for the Folder

  1. Right-click the public folder, and then click Properties.
  2. Change the When posting to this folder, use setting to the name of the post form that you just published, and then 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 creating solutions with Microsoft Outlook, click the article numbers below to view the articles in the Microsoft Knowledge Base:

180826 OL98: Resources for Custom Forms and Programming


182349 OL98: Questions About Custom Forms and Outlook Solutions



Additional query words: OutSol OutSol98

Keywords: kbhowto KB266329