Enhancing Forms

[Previous] [Next]

You can enhance your forms and applications by taking advantage of additional features available in Outlook. If you have any Microsoft Office products installed, you can tie into some of their capabilities. You can also add actions to your forms by customizing Reply and Forward and by using voting buttons. In this section, we'll take a look at these features.

Extending Functionality with Office Document Forms

Office document forms are similar to built-in Outlook forms, but there are enough differences to warrant highlighting this technology in its own section. With Office document forms, you can take advantage of the power of other Microsoft Office products in your applications as well as any development skills you already have. To create an Office document form, select Office Document from the File/New menu. Select the type of document you would like to create. Outlook will prompt you to either e-mail or post this document to someone else in your organization. Select the action that best suits your application: if you need to e-mail your new form to coworkers, create a new e-mail Office form; if you're posting the information to a public folder for others to read at their convenience, post the new Office form.

After creating your Office document form, you can customize the form by using either VBA inside of the Office document or VBScript inside of Outlook. Unlike the standard Outlook forms, Office document forms won't let you add new tabs. Therefore, the only way to customize the Office document form is to use the tools available for the particular Office application you used to create the document form. For example, to customize the values and layout in an Microsoft Excel spreadsheet form, you use Excel tools. A customized Excel document form is shown in Figure 4-24.

click to view at full size.

Figure 4-24. An Excel document form in design mode. Notice how the first page has been customized using the tools provided in Excel.

You can also use the custom properties inside your Office forms as Outlook view properties. For example, an Excel expense reporting form could use its cell values as properties in an Outlook view. This sharing of properties is implemented by creating custom properties in the Office application. You create custom properties in Word and in PowerPoint the same way, except that in Word, the custom properties link to custom bookmarks, and in PowerPoint, the custom properties link to objects in the presentation. Following is a description of how to create custom properties in Excel:

  1. In your Office document form, which is based on an Excel Worksheet, select a cell that contains the value you want to use as a custom property in your Outlook view.
  2. From the Insert menu, point to Name and then select Define.
  3. In the Names In Workbook box, type the custom name you want for the cell, such as Total, and click Add. Click Close.
  4. From the File menu, select Properties.
  5. Click the Custom tab. In the Name box, type the name for your custom property. This can be the same as the name you selected for the cell.
  6. From the Type drop-down list, select the type that corresponds to the values contained in the cell. For example, for a Total field, you should select Number.
  7. Check the Link To Content check box to enable it. From the Source drop-down list, select the custom cell name you created in step 3.
  8. Click Add. In the Properties box, you should see the name, value, and type of the property you just added.
  9. Click OK.

After you create a custom property to hold the value from the Office document, you can add it to your Outlook view. To do this, select the folder where you posted or e-mailed the Office document form. Right-click on the column headings for the view, and select Field Chooser from the menu. In the Field Chooser, open the drop-down list and choose User-Defined Fields In Folder. The Total field should be listed. You can use this property to group, sort, and filter your view. The only restriction on using this property is that you cannot edit it using in-cell editing in Outlook. The properties are read-only inside of Outlook, and you must use the Office document form to edit the properties. Figure 4-25 shows a view of expense reports inside an Outlook folder.

click to view at full size.

Figure 4-25. A view of expense reports inside an Outlook folder. The properties in the view are actually values from an Excel document form.

In design mode for Office documents, you can set the same form properties that you can set for default Outlook forms. These properties include changing the icon for the form, password-protecting the form, and establishing the form contact. For more information on these properties, see the section "Setting Default Form Properties" earlier in this chapter.

NOTE
Outlook also allows you to create custom actions for the form, which is discussed in the next section.

In the same way you can publish custom forms, you can publish your Office document forms so that they are available to all users in an organization. Office document forms display a unique message class determined by the Office application that they are based on. For example, an Excel expense report form could have a message class named IPM.Document.Excel.Sheet.8.Expense Report, and a Word beta agreement form could have a message class named IPM.Document.Word.Document.8.Beta Agreement.

Creating Actions

Actions are either built-in or custom responses to a particular item on a form. They add dynamic functionality to your application with no coding at all. For example, in the Account Tracking application, individual contacts for the company can be created off the master company contact information. In a threaded discussion application, new items are created as responses to posted items. The following section explains how to create actions for Outlook items and associate those actions with custom forms, and it provides strategies for using actions in your applications.

By default, Outlook provides you with four built-in actions for items: Reply, Reply To All, Forward, and Reply To Folder. In many cases, you'll want to customize these actions or create your own. Figure 4-26 shows the Actions page, in which you create actions.

click to view at full size.

Figure 4-26. The Actions page of a form.

To create a new action, follow these steps:

  1. In design mode, click on the Actions tab.
  2. Click the New button at the bottom of the form.
  3. Type the name of your custom action in the Action Name box. This name is used by Outlook to display your custom action on the form or menu.
  4. From the Form Name drop-down list, select a custom form. By default, Outlook displays the custom forms in the active folder. If the desired form is somewhere besides the active folder, you can locate it in one of two ways:
    • Select the Forms option to launch the Choose Form dialog box. You can see and select all hidden forms in the different forms libraries.
    • Type the name of a form in the drop-down list. After you select the form, Outlook automatically enters its message class in the Message Class box.

  5. From the When Responding drop-down list, select the method by which the contents of the original item will be copied to the new form. These are your options:
    • Do Not Include Original Message. Outlook does not include the original item in the action.
    • Attach Original Message. Outlook will attach the original message as an icon in the message body itself or in a separate window at the bottom of the message. The mail format of the attached message will be based on the user's settings.
    • Include Original Message Text. Outlook includes the original message text and some carriage returns before the text in the message body of the form.
    • Include And Indent Original Message Text. Outlook includes the original message text, indented in the message body of the form.
    • Prefix Each Line Of The Original Message. Outlook prefixes each line of the message with the default prefix character the user selected from the Options/E-mail Options menu. By default, the character is a greater-than sign (>).
    • Attach Link To Original Message. Outlook attaches a shortcut to the original message. This functionality is useful when the reply item is a message form that is sent to the user and the original item is posted in a public folder. It allows the user to double-click on the reply item and quickly find the original item without searching the public folder tree for the folder.
    • Respect User's Default. Outlook uses the settings for replying and forwarding messages that were selected by the user from the Options/E-mail Options menu.

  6. From the Address Form Like A drop-down list, choose the way you want to address the form. These are the address options:
    • Reply. Outlook copies the contents of the original From field to the To field in the reply form. No Cc and Bcc information is copied. The Subject field contains the text from the original item.
    • Reply To All. Outlook copies the contents of the original From field to the To field in the reply form as well as Cc information. The Subject field contains the text from the original item.
    • Forward. Outlook clears the address information in the reply form so that the To, Cc, and Bcc fields are empty. However, Outlook does copy the subject of the message to the reply form.
    • Reply To Folder. Outlook places in the Post To field the active folder so that the reply automatically posts to the folder. Outlook also copies the subject of the message into the Conversation field and clears the Subject field. This allows you to create threaded views of your items.
    • Response. This option is used only with voting buttons.

  7. Check the Show Action On check box to make your custom action appear either on both the Actions menu and the toolbar or just on the Actions menu.

NOTE
In some cases, you will want only the action to appear on the menu. For example, if you create a CommandButton control on your form and program the CommandButton control to execute the action when clicked, you might not want the action to also appear in the toolbar. In other cases, you will not want the action to appear on either the toolbar or the menu—for example, when the action is used in an event such as the close event for an Outlook form. In this case, you would not want users to be able to launch this action, only your application.

  1. Select an option from the This Action Will area. The default option, Open The Form, will probably be the one you use most often, but you can choose options to send the form immediately, or to prompt the user about whether to send the form or open it for modification.
  2. In the Subject Prefix box, enter the characters that should precede the Subject in the reply form. Outlook will automatically place a colon after the characters.
  3. Click OK. That's it. Now you have custom functionality on your form without writing a single line of code.

Modifying and Disabling Actions

In addition to creating new actions, Outlook allows you to modify and disable built-in and custom actions so that you can control which actions are available to the user. When you disable a built-in action such as Reply All, you can replace it with your own. Because disabling doesn't actually delete the action, you can reenable it. You can also modify a built-in action so that its functionality is consistent with the functionality of your application.

You modify, disable, and delete built-in actions via the Actions page. To modify or disable the action, select the desired action on the Actions page and click the Properties button to access the Form Action Properties dialog box. To delete an action, select the desired action and click the Delete button. Once you delete an action, you have to re-create it to get it back. If there is any chance that you will need the action in the future, you're better off disabling it.

Actions and Hidden Forms

Actions can take advantage of hidden forms in your applications. Remember that checking the Use Form Only For Responses check box on the form's Properties page hides the form from the user when the user chooses a form to compose. Suppose you are writing a helpdesk application and on your form you want to include an action called "Resolved." The Resolved action launches a new form, which the technician fills out to mark a ticket as resolved. Suppose also that you do not want users creating their own resolved forms. You can hide the resolve form by marking it as a response form and then setting permissions on the folder that prevent users from reading the items posted there. Technicians can open the items and click the resolved action to resolve the ticket. Users will not see the resolved form in their Choose Forms dialog boxes.



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