How Forms Work


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 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 . (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 by simply 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 you work 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 . There are numerous message classes; Table 4-1 lists the message classes for the built-in Outlook forms.

Table 4-1: Message Classes for Built-in Outlook Forms

Form

Message Class

Appointment

IPM.Appointment

Contact

IPM.Contact

Distribution List

IPM.DistList

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, when a user launches a form, Outlook first 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 the forms cache on the local machine. The forms cache is a folder located on the user's local machine; by default, Outlook caches all custom forms in this folder to improve performance. If the form is not in the cache or a newer version of the form is available, Outlook downloads the form's definition into the cache. This automatic update feature ensures that your users will 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 choosing Options from the Tools menu, clicking on the Other tab, clicking the Advanced Options button, and then clicking the Custom Forms button.

If the form is not in the cache, Outlook will search 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 will search the Web forms library in Outlook Web Access (OWA). Note that this works only with Exchange 5.5 OWA, not Exchange 2000 or 2003.

If Outlook cannot find the form in any of the forms libraries, Outlook will use the standard form on which the custom application is based. 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 allows 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. Because the form definition is saved with the message, the size of the message you send to the user increases slightly. You'll learn how to save the form definition with an item later in this chapter.

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 that you understand data binding; otherwise , you can easily run into early design problems.

The layout of the form, or form definition , is separate from the data of the form. Form definitions do not store any application data ”they store data bindings. At run time, Outlook finds the field that the control on the form is bound to, and it 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 2003
Programming MicrosoftВ® OutlookВ® and Microsoft Exchange 2003, Third Edition (Pro-Developer)
ISBN: 0735614644
EAN: 2147483647
Year: 2003
Pages: 227
Authors: Thomas Rizzo

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