MORE INFORMATION
The Outlook object model focuses on folders and the Outlook items in
folders, not the program itself. This means that while you can manipulate
forms and folders, many of the commands or settings that are available
through the user interface are not available when programming.
NOTE: You may be able to use the CommandBars collection to work around some of these object model limitations.
For additional information about programming CommandBars, click the article number below
to view the article in the Microsoft Knowledge Base:
182394 OL98: How to Use Command Bars in Outlook Solutions
When you use the Outlook object model, it is important to note that
information is usually sent directly to the form item. This may result in
different behavior compared to that when a user types information through the user interface. Many of the Intellisense features are handled at the
program level and not the form level. This means that some of these
Intellisense features do not apply when you programmatically modify forms,
or they may only be applied when you save an item. For example, if you
programmatically set a contact's e-mail address, the address is not
be resolved until you save the contact.
There are also controls and field types that have functionality, which is directly incorporated into the program itself and is generally not customizable.
These architectural design considerations are the basis for most of the
Outlook programming limitations, and should be taken into account when you
design a solution.
NOTE: The scope of this article is limited to Microsoft Visual Basic
Scripting Edition (VBScript), and may not take into account possible
solutions that use the Active Messaging object model or other Microsoft
Exchange-related programming technologies. For more information about
these technologies, please consult information provided by the
Microsoft Developer Network (MSDN) on the following Microsoft Web site:
NOTE: Because the Microsoft Web site is frequently updated, the site
address may change without notice. If this occurs, view the following Microsoft home page:
Contact Forms
The General page is the only default page on the Contact form that can be
modified. You can further modify the form by hiding the other default pages
or by using the new, blank pages that are available. If you create a custom form page, you cannot fully recreate the
Birthday and
Anniversary fields on the
Details page of the form because they use a calendar control that is internal to Outlook which cannot be used on accustom form page.
Mail Message Forms
You can fully modify the Message page and you can further modify the form by hiding the Message page or by using the new, blank pages that are available.
Task Forms
You cannot modify the Task and Details pages, but you can modify the form.
Appointment Forms
You cannot modify the default pages of the form, but you can modify the
form by hiding these pages or by using the new, blank pages that are
available.
Journal Entry Forms
You cannot modify the General page of the form, but you can modify the form
by hiding the General page or by using the new, blank pages that are
available.
Note Forms
You cannot customize the
Note form, but you can access the fields of Notes in a folder by using automation and the Outlook object model.
Office Forms
To create a Microsoft Office form, point to
New on the
File menu, and then click
Office Document.
You cannot modify the default pages of the form and you cannot add new
pages to the form. You typically customize this type of form by modifying
the embedded Office document.
For additional information about programming with Office Forms, click the article number below
to view the article in the Microsoft Knowledge Base:
182364 OL98: Programmatically Accessing Office Form Documents
The Calendar Control
The Outlook Contact, Appointment, Task, and Journal Entry forms contain a
calendar that allows you to select a date if you click the day on the calendar. This feature is internal to Outlook and you cannot access it from another program because it is not a separate control.
To see the calendar feature, open a new appointment, and then click the
arrow next to the
Start Date or
End Date boxes. Outlook
displays a small monthly calendar where you can click a date.
Changing Option Settings
There is no way to programmatically change any of the program-level
settings in Outlook because they are not exposed by the object model.
Examples are any of the settings in the
Options dialog box on the
Tools menu.
Modifying Folder Properties
The Outlook object model does not expose folder properties, such as the
default form to use for the folder, synchronization settings, or
AutoArchive settings.
Setting Views
There is no way to programmatically set or configure views, which includes
all of the options on the
View menu. These options are not exposed by the Outlook object model.
Printing
The
PrintOut method is the only way that you can programmatically print an Outlook item or form. There is no way to programmatically alter the way that a form prints. To work around this limitation, you can create a custom template in Word and use automation code to transfer the information from Outlook to Word, and then have Word print the template. You can start this process if you place a button on the Outlook form and use the
Click event for the CommandButton to start the VBScript code to automate Word.
Modifying the Outlook Bar
There is no way to programmatically add folders or items to the Outlook
Bar. You must make all changes through the user interface.
Programming Rules for Incoming Mail
Because all script written in VBScript is stored within individual Outlook items, such as message or contact items, there is no simple way to run the script (fire an event) when mail enters the Inbox. The Rules Wizard does not provide this functionality.
To work around this limitation, you can set up a rule using the Rules
Wizard to forward all relevant messages to an "unprocessed" folder. Then
create a Microsoft Visual Basic application that automates Outlook at
regular intervals; the application would batch-process the items in the
folder and then move or delete them as appropriate.
Modifications to the Post Form
If you edit or otherwise modify the Post form, and then save the changes to the folder without publishing the altered form, your changes are not
preserved when you re-open the form. This allows the Post form to be used
in a one-off fashion.
Posting a File to a Folder
There is no way to post a file as opposed to an Outlook item (such as a
contact, appointment, task, and so on) to a folder by using VBScript or the
Outlook object model.
Microsoft Word 97 and Microsoft Excel 97 do support a
Post method if you want to post a Word document or Excel workbook, but there is no
direct way to specify a folder from within those programs. The
Post method in these programs displays a dialog box that prompts you for a
folder.
Changing the Mouse Pointer to an Hourglass
You cannot control the appearance of the mouse pointer from VBScript. If
you write VBScript script that takes some time to process, you cannot
force Outlook to display an hourglass pointer if Outlook does not do so
automatically.
Storing RTF Information in Message Controls
Each Outlook item can only have one message (or notes) control to store
Rich Text Format (RTF) information, including attachments. You can add more than one control in each form, but the controls are all bound
to the same field so that they display the same information.
Dragging Outlook Items to an OLE Container Control
You can use an OLE container control on a Visual Basic form to hold objects
that you drag to it. When you drag Outlook items to these controls, Outlook exposes a few fields, but there is no way to change which fields are exposed.
Cannot Programmatically Set the Message Control to Read-Only
When a form is in design mode, you can right-click the
Message or
Notes control, click
Properties, and then set the control to read-only. However, when you change the read-only status of the control, VBScript does not have an effect.