Ways to Customize Outlook


Outlook has an object model that consists of 67 objects that combined have more than 1,700 properties and methods. The Outlook object model is about a third as big as the Excel and Word object models and tends to give you less control over Outlook than you would expect. Outlook does have a larger number of events compared with the Word and Excel object modelsmore than 300 events. The large number of events, however, is due mainly to 16 events that are duplicated on 15 Outlook objects.

The main way that you will integrate your code into Outlook is via add-ins. This model was originally designed to allow the integration of COM components written in Visual Basic 6, Visual Basic for Applications, C, or C++. Through COM interop, however, a managed object can masquerade as a COM object and participate in the Outlook add-in model.

Automation Executable

As mentioned in Chapter 2, "Introduction to Office Solutions," you can start Outlook from a console application or Windows application and automate it from that external program. The problem with this approach is that you cannot add your automation executable to the exclusion list of the Outlook object model security guard.

The Outlook object model security guard prevents code from accessing sensitive parts of the Outlook object model, such as the address book or the send mail functionality. Its purpose is to protect Outlook from code that might spread as an e-mail worm or virus. Outlook has a mechanism to trust a particular installed add-in and let it bypass the Outlook object model guard that is discussed in Chapter 11, "Working with Outlook Objects." It does not have a mechanism to trust an automation executable and let an automation executable bypass the guard.

Add-Ins

When building add-ins for Outlook, you have two choices: You can build either a COM add-in or a VSTO Outlook add-in. A VSTO Outlook add-in solves many of the problems associated with COM add-in development and is the preferred model for Outlook 2003 add-in development. You can read about this model for Outlook add-ins in Chapter 24, "Creating Outlook Add-Ins with VSTO." The only time you would want to consider building a COM add-in instead is when you need to target versions of Outlook that are older than Outlook 2003. You can read about building COM add-ins in Chapter 23, "Developing COM Add-Ins for Word and Excel."

Outlook has a COM add-ins dialog box that enables users to enable and disable add-ins. Both VSTO add-ins and COM add-ins appear in the COM Add-Ins dialog box. This dialog box is very well hidden. To access the COM Add-Ins dialog box, you must follow these steps:

1.

Choose Options from the Tools menu to bring up the Options dialog box.

2.

Click the Other tab.

3.

Click the Advanced Options button to bring up the Advanced Options dialog box.

4.

Click the COM Add-Ins button to bring up the COM Add-Ins dialog box, shown in Figure 9.1.

Figure 9.1. The COM Add-Ins dialog box in Outlook.


You can add and remove COM add-ins in the dialog box by using the Add and Remove buttons. VSTO add-ins cannot be added using the Add button but can be removed using the Remove button. Each add-in has a check box that can be checked and unchecked to enable or disable the add-in while leaving it in the list of available add-ins. Typically, you will not use this dialog box to add and remove add-insonly to disable and enable available add-ins. The addition and removal of add-ins is handled by the installer of your COM add-in or VSTO add-in.

Outlook discovers the add-ins that are installed by reading the registry keys under My Computer\HKEY_CURRENT_USER\Software\Microsoft\Office\Outlook\Addins in the registry. You can view the registry on your computer by going to the Windows Start menu and choosing Run. In the Run dialog box, type regedit for the program to run; then click the OK button. You can also register add-ins for Outlook under My Computer\HKEY_LOCAL_MACHINE\Software\Microsoft\Office\Outlook\Addins. Add-ins registered under HKEY_LOCAL_MACHINE do not appear in the COM Add-Ins dialog box and cannot be enabled or disabled by users.

Smart Tags

Smart Tags are a feature that enables the display of a pop-up menu with actions for a given piece of text on the screen. Outlook supports Smart Tags in several ways.

Smart Tags When Word Is the E-Mail Editor

First, if Word is used as the e-mail editor in Outlook, Smart Tags appear when you edit e-mail messages. To set Word as the e-mail editor, you can use the Options command in the Tools menu to display Outlook's Options dialog box. On the Mail Format tab, check Use Microsoft Office Word 2003 to Edit E-Mail Messages, as shown in Figure 9.2.

Figure 9.2. Specifying Word as the e-mail editor.


In addition to specifying Word as the e-mail editor, you must configure Word's Smart Tag options as described in Chapter 6, "Programming Word." Then, when you create a new e-mail message, you will be able to see Smart Tags in your message, as shown in Figure 9.3.

Figure 9.3. Smart Tags in an e-mail message when Word is the e-mail editor.


Smart Tags in the Research Task Pane When Word Is the E-Mail Editor

You can register Smart Tags to recognize text in the Research task pane. If Word is being used as the e-mail editor, the user can select some text in the e-mail, right-click the text, and choose Look Up to bring up the Research task pane. Results in the Research task pane may include text that is tagged by Smart Tags.

Smart Tags Embedded in HTML-Formatted E-Mail and Displayed in the Reading Pane

A third way Smart Tags are supported in Outlook is when you use Word as the e-mail editor and send e-mail in HTML format. If Word's send format is configured appropriately, Smart Tags can be embedded in the HTML-formatted message. Users who read the messages that have Smart Tags installed and have Outlook's security settings set to allow them will be able to see Smart Tags in Outlook's reading pane. Outlook's reading pane is effectively an HTML Web browser.

To configure this use of Smart Tags, you must first specify Word as the e-mail editor and choose the send format to be HTML, as shown in Figure 9.2 earlier in this chapter. To configure Word to be able to embed Smart Tags in HTML, you must choose Options from the Tools menu of Word to bring up Word's Options dialog box. In this dialog box, select the General tab, and click the E-Mail Options button. This brings up the E-Mail Options dialog box, shown in Figure 9.4. In the General tab of this dialog box, you must set the HTML filtering options to None or Medium and check the Save Smart Tags in E-Mail check box.

Figure 9.4. E-mail options to enable the embedding of Smart Tags in HTML e-mail messages.


Finally, you must ensure that the security settings of Outlook will allow Smart Tags to appear. In Outlook's Options dialog box, select the Security tab, and make sure that Zone is set to Internet, as shown in Figure 9.5.

Figure 9.5. Internet zone security required to allow Smart Tags to be displayed in e-mail messages.


With all these settings configured, you should be able to type an e-mail message and send it, and when it is received, you can see the Smart Tag in the reading pane, as shown in Figure 9.6. The Smart Tag looks a little different because the reading pane uses Internet Explorer's menu style rather than the Office menu style.

Figure 9.6. A Smart Tag displayed in the reading pane.


Persona Menu Smart Tags

The final way Smart Tags are supported in Outlook is via the Persona menu. This menu appears on e-mail items and other Outlook items when you click the Persona icon shown in many Outlook views. Figure 9.7 shows the Persona icon and the menu that appears when you click it. Smart Tag actions appear in the Additional Actions submenu that is shown in Figure 9.7.

Figure 9.7. The Persona menu in Outlook. Smart Tag actions appear in the Additional Actions submenu.


VSTO cannot be used to provide Smart Tags for Outlook because VSTO supports Smart Tags only for code behind a document. The Outlook uses of Smart Tags are not at the document level but at the application level. Chapter 16, "Working with Smart Tags in VSTO," describes how to create an application-level Smart Tag in Visual Basic that could be used in e-mail when Word is your e-mail editor.




Visual Studio Tools for Office(c) Using Visual Basic 2005 with Excel, Word, Outlook, and InfoPath
Visual Studio Tools for Office: Using Visual Basic 2005 with Excel, Word, Outlook, and InfoPath
ISBN: 0321411757
EAN: 2147483647
Year: N/A
Pages: 221

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