Microsoft KB Archive/291407

= Description of Outlook 2002 View Control =

Article ID: 291407

Article Last Modified on 3/29/2007

-

APPLIES TO


 * Microsoft Outlook 2002 Standard Edition

-



This article was previously published under Q291407



IMPORTANT: The original Outlook 2002 View Control poses a security risk.

For additional information about this security risk and the update that is available, click the following article number to view the article in the Microsoft Knowledge Base:

303835 OL2002: The Outlook View Control Exposes Unsafe Functionality



For a Microsoft Outlook 2000 version of this article, see 281618.



SUMMARY
This article provides an overview of the Microsoft Outlook 2002 View Control.



Overview
The Microsoft Outlook View Control displays information about a specific folder and can be integrated into solutions to provide access to Outlook data. The control can be placed in any container that supports ActiveX controls, including an HTML page, a Microsoft Visual Basic form, a Microsoft Visual Basic for Applications UserForm, or a custom Outlook form. You can programmatically set the control's properties to customize the folder and view that is displayed in the control.

The control can be used to create a variety of solutions that are designed to integrate Outlook data. For example, you can place multiple view controls on an HTML page so that a user can view the contents of more than one folder within a single window. This can be useful in a scenario where you want to display calendar information for more than one user at the same time.

One of the key features of the Outlook View Control is that you can use the Restriction property of the control to filter out certain types of data. For example, you can display the Tasks folder in the Outlook View Control, and then filter the folder to show only those tasks for a certain contact.

IMPORTANT: There are differences in how the control functions depending on whether or not the control is being used in an Outlook folder home page. These differences include features of the view control itself, in addition to the Outlook features that the view control exposes. The differences exist because if the control is used from within Outlook, it can access information that is not exposed when the control is run externally to Outlook. It is often helpful to know that these differences can occur. If you are intending to use the control outside of Outlook, you may want to test the control's behavior on an Outlook folder home page to see if there are any differences. Likewise, if you are intending to use it on a folder home page, you may want to test the HTML page in a browser to make sure that the same functionality is provided. The following list contains the limitations of the Outlook View Control when it is not used on an Outlook folder home page:   Retrieving the OutlookApplication property. Instead, use the CreateObject method, such as: Set objOL = CreateObject(&quot;Outlook.Application&quot;)  Retrieving the Folder property (although it can be set). Retrieving the ActiveFolder property.

Information About the Updated View Control
For security reasons, changes were made to the Outlook View Control to limit its functionality when the control is hosted outside of Outlook. In particular, the View property cannot be changed unless the control is used within Outlook.

IMPORTANT: One side effect of this change is that if you use the control in an HTML page and use the Object tag to set the View property, all of the other properties you specify will not be applied. A typical symptom after using the updated Outlook View Control is that the control displays the Inbox even though you specify a different folder parameter. To work around this, you can either remove the View parameter completely so that it does not affect the other parameters, or you can use a scripting language to programmatically set the property, as shown in the example provided later in this article.

Outlook 2002 View Control Is Automatically Installed
Unlike the earlier version of the Outlook View Control, the Outlook 2002 version is automatically installed with Outlook 2002. You do not need to be concerned with deploying the control.

How to Obtain Documentation for the View Control
Documentation for the Outlook 2002 View Control is available on the Microsoft.com Download Center:

http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=831F957F-3190-48DA-A099-2BDBC7397623

Using the Outlook View Control in Development Environments
The Outlook View Control is primarily designed to be used in an HTML page, such as an Outlook folder home page, so the properties of the control are primarily designed to be set programmatically.

HTML Environments
In HTML, you can use the  tag, and then set the properties of the control by using parameters. As an example, the following HTML code illustrates how to set which folder and view to display:

  <param name=&quot;Folder&quot; value=&quot;Calendar&quot;> <param name=&quot;View&quot; value=&quot;Day/Week/Month View With AutoPreview&quot;> <param name=&quot;Restriction&quot; value=&quot;&quot;> <param name=&quot;DeferUpdate&quot; value=&quot;0&quot;> </OBJECT>

Or, you can use a scripting language to programmatically reference the control and set the properties by using script. For example, the following HTML code uses Microsoft Visual Basic Scripting Edition (VBScript) to display the contents of a delegate's folder: <BUTTON id=&quot;cmdButton&quot; onclick=&quot;ViewResource;&quot;>Show Resource Calendar</BUTTON><BR>

<script language=VBScript>

' Change &quot;recipientname&quot; to a valid alias of someone who has given ' you permission to view a folder.<BR/> CONST oRecipName = &quot;=recipientname&quot;

' The list of constants for the folder types you can specify below: CONST olFolderDeletedItems = 3 CONST olFolderOutbox = 4 CONST olFolderSentMail = 5 CONST olFolderInbox = 6 CONST olFolderCalendar = 9 CONST olFolderContacts = 10 CONST olFolderJournal = 11 CONST olFolderNotes = 12 CONST olFolderTasks = 13 CONST olFolderDrafts = 16

Sub ViewResource If cmdButton.Value = &quot;Show Resource Calendar&quot; Then viewCtl1.Width = &quot;100%&quot; ViewCtl1.Height = &quot;80%&quot; ViewCtl1.OpenSharedDefaultFolder oRecipName, olFolderCalendar cmdButton.Value = &quot;Hide Resource Calendar&quot; Else viewCtl1.Width = &quot;1&quot; ViewCtl1.Height = &quot;1&quot; cmdButton.Value = &quot;Show Resource Calendar&quot; End If  End sub

Visual Basic and Visual Basic for Applications Environments
You can add the Outlook View Control to a custom form in Microsoft Visual Basic or Microsoft Visual Basic for Applications. However, it may be problematic if you set control properties at design time. For example, in Visual Basic, if you click the ellipses (...) button in the Properties window, you receive the following error message:

System error &H800040002 (-2147467262). No such interface supported

The Outlook View Control has multiple states, and clicking the control once does not select the control in the design environment, but rather places focus within the Outlook folder. To select the control so that you can view its properties or delete it, follow these steps:
 * 1) Display the form that contains the view control.
 * 2) Right next to the control, click the form itself, and hold down the left mouse button.
 * 3) Drag the mouse over the control.
 * 4) Release the mouse button.

After you select the control in this manner, you can then press the DELETE key to remove it from the form.

IMPORTANT: If you are using the control on a Visual Basic form, be especially careful because it is possible to send key strokes directly to Outlook, which can cause adverse effects, such as deleting items in a folder, if you press the appropriate key strokes.

<div class="references_section">