Microsoft KB Archive/266331

From BetaArchive Wiki

Article ID: 266331

Article Last Modified on 1/27/2007



APPLIES TO

  • Microsoft Outlook 97 Standard Edition



This article was previously published under Q266331


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 File menu, click Publish Form As.
    2. In the Publish In box, type WordDoc, and then click Publish In.
    3. In the Set Library To box, click Folder Forms Library.
    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.
    6. In the folder list, click your public folder, click OK, and then click Publish.
    7. On the File menu, click Close, and then click No when you are prompted to save your 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, click Design Outlook Form.
  3. On the Form menu, click View Code. This opens Script Editor.
  4. Type the following 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 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, click Publish Form As on the File menu.
  7. In the Form name box, type a name for the form.
  8. Click Publish In, and then click Folder Forms Library in the Set Library To box.
  9. In the Folder List pane, click your public folder, click OK, and then click Publish.

    If you do not see the Folder List pane, click Folder List on the View menu.
  10. On the File menu, click Close, and then click No when you are prompted to save your changes so that a new item is not created.

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 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:

166368 OL97: How to Get Help Programming with Outlook


170783 OL97: Q&A: Questions About Customizing or Programming Outlook



Additional query words: OutSol OutSol97

Keywords: kbhowto KB266331