Caching Outlook forms in C#, VB.NET, Chrome

Add-in Express™ Extensions
for Microsoft® Outlook®

Add-in Express Home >

Cached forms

Outlook creates a new instance of its any windows embedded into the Explorer and Inspector windows whenever the user switches between folders. In contrast to this behavior, the Add-in Express Extensions for Outlook can create one instance of the custom form when the user visits a folder for the first time and dispose this instance when the user closes Outlook. So, we say that the Add-in Express Extensions for Outlook caches embedded forms, which allows your add-in to considerably expedite switching between Outlook folders.

The Extensions for Outlook provides two very important built-in caching strategies that you should be aware of. You can enable or disable caching via the Cached property of the item that binds your custom form to Outlook folders.

NewInstanceForEachFolder

By default, the Extensions creates one instance of your form for each folder visited by the user in the current Explorer window. This strategy is called NewInstanceForEachFolder. For example, if you bind your form to two folders, two form instances will be created if the user visits both folders (bound to your form) in the same Explorer window. If the user opens a second Explorer window and visits two folders in each Explorer window, four instances of your form will be created.

This caching strategy has been developed to give you a possibility to create unique content for each folder visited by the user. Please take this into account when developing embedded forms and their initialization and finalization code. Perhaps, you may need to have some common data for all instances of your custom forms and to show these data on each form instance. In this case, you can use the add-in module accessible from your form via the AddinModule property.

1. By default, all forms are cached by the NewInstanceForEachFolder strategy. You can disable or change this via the Cached property of the corresponding collection item of the Outlook Forms Manager.

2. If you disable caching for your form, a new instance of your form will be created whenever the user visits each folder bound to your form.

3. Any run-time changes of the corresponding item dispose all cached instances.

OneInstanceForAllFolders

The second built-in caching strategy is OneInstanceForAllFolders. It creates one instance of your forms for all folders bound to your forms and shows this instance for all folders in the same Explorer window. For example, if you bind one form to all mail folders, one instance will be created if the user visits any number of mail folders in the same Explorer window. If the user opens a second Explorer window and visits any mail folders in both Explorer windows, two instances of your form will be created (one instance for each Explorer).

Why are instances of your form created for each Explorer window? In general, MS Windows cannot show one instance (window) on two windows at the same time. So, your forms should have different instances for each Explorer window.

This caching strategy was developed to give you a possibility to create one form for all folders visited by the user. Please take it into account when developing embedded forms and their initialization and finalization code.

Note. The caching strategies do not apply to Advanced Form Regions. A new instance of your embedded form is created for each Advanced Form Region when a new Inspector is opened.