Designing Forms

[Previous] [Next]

You need to consider a variety of issues when designing your 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 the tasks in the following list. In the rest of this chapter, you will learn how to perform all these tasks.

  • Which pages to display on the form
  • Whether to separate the read layout from the compose layout
  • Which fields to include on the form
  • What information you want visible on the form
  • Whether to use built-in or custom fields
  • What the fields will look like

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 the following two methods: open a standard form of the type you want to modify and enter design mode; or select a form from a list of available forms, which automatically opens the form in design mode. To use the second method, follow these steps:

  1. From the Tools menu, point to Forms, and then select Design A Form. Outlook presents you with the Design Form dialog box, as shown in Figure 4-5.
  2. From the Look In drop-down list, find the location of the form you want to modify. 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.

click to view at full size.

Figure 4-5. The Design Form dialog box in Outlook.

To create a new form based on an Office document and open it in design mode, do this:

  1. From the File menu, point to New, and then select Office Document.
  2. Double-click on the icon representing the type of Office document you want to create.
  3. Select either the Post The Document In This Folder option or the Send The Document To Someone option, and click OK.
  4. From the Tools menu of the freshly opened document, point to Forms and then select Design This Form to enter design mode.

For more information on customizing Office document forms, refer to the section "Extending Functionality with Office Document Forms," later in this chapter.

Choosing Display Properties

When designing your Outlook application, you need to decide whether you want to display, rename, or hide the default pages on the form. Your decision is based on what you will use the forms for. For example, if you wanted to preaddress an item sent to users to prevent them from modifying the values in the address field or knowing where the item was being sent, you could 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 since 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 the best example of a form that effectively uses compose and read pages.

Outlook enables you to separate the compose page and the read page from 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 a Message form have the Separate Read Layout option enabled. However, your custom pages, by default, do not have this option enabled. To enable Separate Read Layout, in design mode, select the form page where you want separate compose and read layouts. On the Form menu, make 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 displaying the Form menu and choosing either Edit Compose Page or Edit Read Page.

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 reenable 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 view at full size.

Figure 4-6. You can drag 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 designing your application. In this section, we will briefly discuss the address fields, the Subject field, and the Message field.

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 either 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 that 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 attempts to forward the form, the address you have supplied will automatically appear in the displayed Message form.

If you are preaddressing a form to a folder (as opposed to a user), either the folder has to be exposed in the Global Address List or you have to copy the folder address into your personal address book. To expose the folder in the Global Address List, you must have administrator rights on the Exchange Server system. To expose the folder in the Global Address List, launch the Microsoft Exchange Administrator program. Expand the folder trees to find and select the folder you want to expose. Choose File and then Properties. On the Advanced tab, uncheck the Hide From Address Book check box, and click OK.

Shared Fields

Outlook supports shared fields in an item. Shared fields are any 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 also 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, which we briefly looked at in Chapter 5. If you want to have a threaded view of the items in your application, the second point is important to remember.

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 that you want to modify in run mode. From the Insert menu, select File and 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 add file shortcuts using the HTML mail format, you have to add hyperlinks in the Message field that points to your files.

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

  • file://. Use for adding hyperlink shortcuts to any file stored on a file server that your computer can access. Examples include:
    • file://c:\temp. Use 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>. Use for linking to files or directories on other servers. Useful for sending users shortcuts to shared files or directories. Notice that the hyperlink is placed in brackets—this is required if the hyperlink contains any spaces.

  • http:// or https://. Use 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 the Hypertext Transfer Protocol (HTTP). HTTPS uses the secure socket layers to encrypt the traffic between the web browser and the Web server. Examples of using the HTTP protocols are:
    • http://www.microsoft.com/exchange. Use for linking quickly to external sites.
    • http://finance/earnings.htm. Use for linking to internal sites. These internal sites could be individual servers that users set up or part of your organization's intranet.

  • mailto:. Use for adding shortcuts that allow the user to preaddress a message to the specified location, even if the user is not using Outlook but needs to respond to messages automatically sent by Outlook. You will see an example of this capability when we look at the Exchange Server Routing Objects in Chapter 13. Examples of mailto hyperlinks follow:
    • mailto:thomriz. Use 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 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 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. The mailto hyperlink automatically fills in the message subject and text.

  • Outlook. Used to create a hyperlink directly to Outlook information. This protocol is supported only if Outlook is installed on the local machine. Examples follow:
    • Outlook:Inbox\Subfolder. Used 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, and Journal.
    • <Outlook:Contacts/~Thomas Rizzo>. Used to link to a specific item in the folder. This example will open 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>. Used to link to a public folder. This example will open the Discussion public folder. You can also use a similar syntax to open only the public folder tree or access a user's favorite folders stored in Public Folders\Favorites.
    • Outlook:EntryID. Used to link 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 Routing Objects and you need to send a link to an item in a public folder. Collaboration Data Objects (CDO), today, does not 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. Here is an example of this protocol:
    • Outlook:EF000000D4B32904495CD111921D08002BE4F322646C2700

      This is a short-term EntryID. You can also use long-term EntryIDs.

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 would use the following syntax for the Outlook protocol: Outlook:Inbox/~Earnings%20reports.

The Message control and its underlying field, the Message field, provide extensive functionality to your applications. However, there are some restrictions on usage of the Message control inside of an Outlook form. First, you should create only one Message control on an Outlook form. Since the Message control is automatically bound to the Message field, more than one control will cause a conflict regarding 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, "Using Controls."

Second, only the Message control accepts attachments or the hyperlinks we reviewed earlier in the chapter. 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
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