Designing Forms


Once you determine the purpose of your form and which form to modify, you have to open the form in design mode and make decisions about a variety of issues.

Outlook provides an environment for creating and editing forms, which is sometimes referred to as the forms designer. The forms designer is automatically installed with Outlook.

Opening a Form in Design Mode

Opening a form in design mode is easy. If the form is not based on an Office document, you can use one of two approaches: open a standard form of the type you want to modify and enter design mode by choosing Forms, Design This Form from the Tools menu; or select a form from a list of available forms, which automatically opens the form in design mode. To use the second approach, follow these steps:

  1. From the Tools menu, choose Forms, Design A Form. The Design Form dialog box (shown in Figure 4-5) will open.

    click to expand
    Figure 4-5: The Design Form dialog box in Outlook

  2. In the Look In drop-down list, find the location of the form you want to modify or use as a template. You can select forms from any forms library as well as from templates in the file system.

  3. Click the Details button to display the properties of the currently selected form, which include the icon, description, contact, version, and message class of the form.

  4. Click Open to open the selected form in design mode.

Choosing Display Properties

When you design an Outlook application, you must decide whether to display, rename, or hide the default pages on the form. Your decision will be based on what the forms are for. For example, if you want to preaddress an item sent to users to prevent them from modifying the values in the address field or knowing where the item is being sent, you can fill in the address information on the message and then hide the default pages. To change the display properties for a form page or to rename a default or custom page, enter design mode, click on the desired page, and then select the appropriate option from the Form menu. You can quickly see the display status of a form page in design mode because Outlook places parentheses around the name of any page that will be hidden at run time.

Separating the Read Layout from the Compose Layout

Outlook supports having separate layouts for compose and read form pages. The compose page appears when a user opens a form to compose a new item. The read page appears when a user double-clicks on an item to view it. The standard e-mail message is a great example of a form that effectively uses compose and read pages.

Outlook enables you to separate the compose and read pages for a form so that you can add custom functionality to each of these user modes. Outlook supports compose and read pages on every customizable forms page. By default, the Message page on an Outlook Post form and on a Message form have the Separate Read Layout option enabled. However, your custom pages, by default, do not. To enable Separate Read Layout, in design mode, select the form page where you want separate compose and read layouts. On the Form menu, be sure there is a check mark next to Separate Read Layout. Outlook automatically copies the layout from the compose page to the read page. You can then select the layout you want to modify by selecting the appropriate edit option from the Form menu.

If you find that you are making extensive changes to the compose page and you want to discard your read page and re-create it with the layout of the compose page, you can disable the Separate Read Layout option and then re-enable it. Outlook will copy the layout of the compose page to the new read page.

Using the Field Chooser to Drag and Drop Fields

The Field Chooser provides a simple way to drag and drop built-in and custom fields onto your form. When you drag and drop a field from the Field Chooser onto the form, Outlook creates the appropriate controls. If the AutoLayout option is enabled on the Layout menu, Outlook automatically positions your controls on the form. The controls that Outlook creates are based on the data type of the associated field. For example, if you drag and drop a field with a data type of text , Outlook will automatically create a text box control and typically a label control with the name of the field. If you drag and drop a field with a data type of Yes/No , Outlook will create a check box control with the Caption property set to the name of the field. Figure 4-6 shows a Post form with the controls for the Attachment, Categories, From, Icon, and Importance fields added by using the Field Chooser.

click to expand
Figure 4-6: Dragging fields from the Field Chooser to an Outlook form

Important Default Fields

Outlook includes some important default fields, such as the address fields, that you should take advantage of when you design an application. We'll briefly discuss the address fields, the Subject field, and the Message field next.

Address Fields

The address fields include From, To, Cc, and Bcc. The address fields enable you to preaddress your form to individual users or distribution lists by typing an address at design time or by setting the initial value of the fields. (You will see how to set initial values later in this chapter.) You can enable these fields if you want to allow the user to change the address, but most likely you will want to disable the To field and just expose the Cc field so a user can send a copy of the form to another user. By default, the To field is exposed only on a Message form, but you can use the Field Chooser to drag and drop the To field or any other address field onto another type of Outlook form and set its initial value. This ensures that if the user forwards the form, the address you have supplied will automatically appear in the displayed Message form.

To preaddress a form to a folder (as opposed to a user), either the folder has to be exposed in the Global Address List (GAL) or you have to copy the folder address into your personal address book. To expose the folder in the GAL, you must have administrator rights on the Exchange Server system. You launch the Microsoft Exchange System Manager program and expand the folder trees to find the folder you want to expose. Right click on it and choose Properties. On the Exchange Advanced tab, deselect the Hide From Exchange Address Lists check box, and click OK.

Note  

Outlook supports shared fields in an item. Shared fields are controls that are bound to the same field on both a compose page and a read page of a particular form. A user can modify the field on either page, and the changes will be available universally . Shared fields can be used between Outlook forms ”for example, when you respond to an item in a folder using a custom form, Outlook copies the values from the shared fields in the open item to the same field in the response item.

Subject Field

The Subject field is important for two reasons. First, the text in the Subject field is the caption that appears at the top of a form. Second, the Subject field typically takes its value from the Conversation field. This point is important if you want to have a threaded view of the items in your application.

The value of the Subject field can also be determined by formulas. For example, you can create a formula that sets the value of the Subject field by combining two other fields on your form.

Message Field

The Message field is the only field for which text formatting, attachments, hyperlinks , and objects are supported. This extensive support allows you to embed instructions or other important material as an attachment, or to add shortcuts to Web sites, files, or other Outlook items. To add an attachment to the Message field, open the item you want to modify in run mode. From the Insert menu, choose File, and then find the file you want to insert.

Note that if you are using HTML as your default mail format in Outlook, you can insert files only as attachments or text. If you are using the Outlook Rich Text mail format, you can insert files as attachments, shortcuts, text, or embedded objects. To simulate file shortcuts using the HTML mail format, you have to add hyperlinks in the Message field that point to your files.

Outlook supports many protocols that you can place in the Message field as hyperlinks. The most useful protocols are:

  • file://    For adding hyperlink shortcuts to any file stored on a file server that your computer can access. Examples include:

    • file://c:\temp    For linking to files or directories on your own file system and for pointing at files that are unique to each user's system.

    • file://docserver/docs/ earning statements    For linking to files or directories on other servers. This format is useful for sending users shortcuts to shared files or directories. Notice that the hyperlink should be placed in brackets ”this is required if the hyperlink contains any spaces.

  • http:// or https ://    For adding hyperlink shortcuts to Internet and intranet Web sites. The difference between the protocols is that Hypertext Transfer Protocol Secure (HTTPS) is a secure version of Hypertext Transfer Protocol (HTTP). HTTPS uses Secure Sockets Layer (SSL) to encrypt the traffic between the Web browser and the Web server. Here are two examples that use the HTTP protocol:

    • http://www.microsoft.com/exchange    For linking quickly to external sites.

    • http://finance/earnings.htm    For linking to internal sites. These internal sites can be individual servers that users set up or can be part of your organization's intranet.

  • mailto:    For adding shortcuts that allow the user to automatically address a message to the specified location, even if the user is not using Outlook but needs to respond to messages automatically sent by Outlook. Here are a few examples of mailto hyperlinks:

    • mailto:thomriz    Use this format if the default mail program of your users is Outlook, which enables you to use the user's simple address. Outlook automatically resolves the name by using an address book.

    • mailto:thomriz@microsoft.com    Use this format when you cannot guarantee that the user of the mailto hyperlink is an Outlook client.

    • mailto:thomriz@microsoft.com?subject=Great Book&body=I loved every minute    Use this format to pass additional information after the address of the item. The formatting of the information is exactly the same as when you pass variables along an HTTP query string. This mailto hyperlink automatically fills in the message subject and text.

  • Outlook:    For creating a hyperlink directly to Outlook information. This protocol is supported only if Outlook is installed on the local machine. Here are some examples:

    • Outlook:Inbox\Subfolder    For linking to Outlook folders. In this example, the Subfolder folder of the Inbox will appear on the machine of the user. You can replace Inbox with the name of another Outlook folder, such as Tasks, Contacts, Calendar, or Journal.

    • Outlook:Contacts/~Thomas Rizzo    For linking to a specific item in the folder. This example opens the Thomas Rizzo contact in the Contacts folder of the current user. Remember to place the hyperlink in angle brackets if it contains spaces.

    • <Outlook:\\Public Folders\All Public Folders\Discussion>    For linking to a public folder. This example opens the Discussion public folder. You can use a similar syntax to open only the public folder tree or to access a user's favorite folders stored in Public Folders\Favorites.

    • Outlook:EntryID    For linking to items in the Outlook environment by using the EntryID. This is useful if you are generating mail messages using the Microsoft Event Scripting Agent or the Microsoft Workflow Engine and you need to send a link to an item in a public folder. Collaboration Data Objects (CDO) does not currently provide this functionality, but using Outlook:EntryID is a great workaround. The only problem is that the Outlook protocol requires Outlook on the local machine. Also, if you try to access an item in a public folder and the user has not yet accessed the Public Folder hierarchy, this type of link will fail. Here is an example of this protocol:

Outlook:EF000000D4B32904495CD111921D08002BE4F322646C2700

This is a short-term EntryID. You can also use long-term EntryIDs. Long- term EntryIDs are valid between Outlook sessions and should not start with EF . Short-term EntryIDs are valid only in the current session, so do not save them off to permanent storage and attempt to use them as a long-term identifier for the item or folder.

You can also express spaces in any of these protocols by using the characters %20 . For example, to link to a specific message in your Inbox with the subject Earnings reports , you use the following syntax for the Outlook protocol: Outlook:Inbox/~Earnings%20reports .

The Message control, which is inserted in your form when you insert a Message field, and its underlying field, the Message field, provide extensive functionality to your applications. However, there are some restrictions on the use of the Message control inside an Outlook form.

First, you should create only one Message control on an Outlook form. The Message control is automatically bound to the Message field, so more than one control will cause a conflict over which content should be saved to the Message field. For example, if you have three Message controls on different pages in the Outlook form and a user writes a different value to each control, Outlook will save the contents of only one of those controls. This means that only one value of the Message field will be displayed in all three Message controls.

Note  

Outlook automatically displays a warning message if you attempt to place multiple Message controls on a form. If you need to sidestep this restriction because your application needs to span multiple pages with Message controls across each page, you should use a MultiPage control and keep only one Message control at the bottom of the form. For more information on how to use MultiPage controls, see the next section.

Second, only the Message control accepts attachments or the hyperlinks we looked at earlier. The other controls in Outlook do not understand hyperlinks and will not automatically display and link information.

Third, the Message control is always bound to the Message field, and Outlook automatically establishes this binding. You cannot change it, nor can you set initial values of the Message control in design mode. You must either insert your hyperlinks, text, or attachments before designing the form or insert them programmatically.




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