How Forms Work

[Previous] [Next]

Before we dive into building forms, let's step back and take a look at how forms work inside the Outlook and Microsoft Exchange Server environments. When you double-click on an Outlook item to open it, Outlook queries a property on the item named the message class. The message class uniquely identifies the form that the item is based on. For example, when you create a new e-mail message, you are creating a form with the message class IPM.Note. (The IPM stands for interpersonal message.) When you send the message to another user, the message class travels with the item as a property. You can see all the different message types simply by adding the message class property to your views. These message classes are extensible, so you can create your own types of forms with unique message classes.

When working with forms in the Outlook development environment, you have to base them on built-in forms. You cannot start with a blank slate as you can with Visual Basic forms. After you customize your form, you can publish it. This is where you can customize the message class. For example, if you modify the standard Outlook Appointment form to make it a class registration system, you can publish the form with its own unique message class, such as IPM.Appointment.Class Registration Form. Although there are multiple message classes, the following list shows the message classes for the built-in Outlook forms:

Form Message Class
Appointment IPM.Appointment
Contact IPM.Contact
Journal IPM.Activity
Message IPM.Note
Post IPM.Post
Task IPM.Task

These message classes work in conjunction with the different forms libraries in Outlook. For example, if a user tries to launch one of your custom forms, Outlook searches the different forms libraries to find it. First Outlook checks to see whether the item is a standard form such as the Note form or a Post form. If the item is not a standard form, Outlook checks its forms cache on the local machine. The forms cache is a folder located on the user's local machine, and by default, Outlook caches all custom forms into this folder to improve performance. When a user launches a form for the first time, Outlook downloads the forms definition into the cache. If you change the form, the version of the form in the forms cache will be updated automatically the next time the user tries to launch that particular form type. This automatic update feature ensures that your users always use the most recent version of the application even after you've modified your forms. The user can change the size of the cache in Outlook by selecting Options from the Tools menu, clicking the Other tab, clicking the Advanced Options button, and then clicking the Custom Forms button.

If the form is not in the cache, Outlook searches the forms library of the current folder. If the form is not in the current folder, Outlook searches the user's Personal Forms Library and the Organizational Forms Library. If the user has Web Services enabled in Outlook, Outlook searches the web forms library.

NOTE
Web Services is especially useful if you plan to convert your Outlook forms to HTML forms by using the Outlook HTML Forms Converter. To learn more about Web Services, refer to Chapter 7.

If Outlook cannot find the form in any of the forms libraries, the standard Outlook form on which the custom application is based is used. For example, if a user receives an appointment item with a message class of IPM.Appointment.Job Interview, and the form does not exist in any of the forms libraries, Outlook will use the standard Appointment form to open the message.

Outlook enables you to save the form definition directly with an item, so when a user does not have a copy of your custom form installed in any of her forms libraries or the user is in a different organization, she can still receive your item and view it. Since the form definition is being saved with the message, the size of the message you send to the user will increase slightly. You'll learn how to save the form definition with an item later in this chapter in the section "Publishing Forms."

Data Binding

To retrieve and set the underlying properties of the form, Outlook uses data binding. If you are new to developing with Outlook, it is important to understand data binding because misunderstanding it is often the cause of early design problems.

The layout of the form, or form definition, is separate from the data of the form. Form definitions, then, do not store any application data. Instead, they store data bindings. At run time, Outlook finds the field that the control on the form is bound to, and retrieves and sets the value of the control. The most common mistake new developers make is to add a new control on a form without setting its data binding. If the control is not bound to any field, Outlook does not maintain the data in the Exchange Server database. You will learn how to implement data binding later in this chapter.



Programming Microsoft Outlook and Microsoft Exchange
Programming Microsoft Outlook and Microsoft Exchange, Second Edition (DV-MPS Programming)
ISBN: 0735610193
EAN: 2147483647
Year: 2000
Pages: 184

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net