About: Outlook Object Model (OOM)

API Type:  Mailbox Accessor

API Interface:  COM Library

Business Logic: Richest Outlook item support (Mail, Tasks, Calendar, etc.).

Language Support: All COM compatible languages including .NET.

Direct Property Access:  Only available in OOM for Outlook 2007 and later.

Summary:

 

Outlook Object Model (OOM) is a COM library which automates Outlook.EXE.  While it doesn't provide every configuration option and feature of the Outlook UI, it does provide a rich object model for working with Outlook IPM types.   OOM objects can be use by outlooks in-application VBA, under managed cod (.NET) code and also under unmanaged code (C++, etc).

Points of Interest:

  • OOM is built on top of Extended MAPI and is a part of Outlook.EXE.
  • A full install of Outlook needs to be installed on the machine OOM is used.  Installing Outlook components only is not supported.  Also see your Outlook EULA about distributing unlicensed Outlook components.
  • Even though it is build on top of Extended MAPI, it is still supported under managed code (.NET) process.
  • Because OOM is automating Outlook.EXE which is a desktop application it is not supported in a service (web service, windows service, ASP.NET, ASP, COM+, etc). An interactive user who can respond to visual UI prompts is required when OOM code is running.
  • Beware of known when using OOM in a .NET application be it a VSTO add-in, COM add-in, or standalone application.  Because of the way Outlook attempts to reuse item references in the UI, there are many issues that can come up in .NET solutions that use OOM if items are not explicitly released when a reference is created.
  • Outlook 2007's object model added support for working with Rules and even adds the PropertyAccessor for working directly with MAPI properties.
  • An application automating OOM needs to run at the same integrity/elevation level as Outlook. Outlook runs at medium IL.  Process Explorer can show you the elevation levels.
  • In an add-in OOM is only supported on the main thread.
  • its possible to mix the usage of OOM and Exchange Web Services in an application since EWS can convert item identifiers used by different APIs.  I've seen this mixture occasionally in Outlook add-ins.
  • You need to understand the issues with bitness when building applications using Outlook Object Model (OOM).  If you do not then you may likely run into issues during deployment.
  • Outlook PIA's (Primary Interop Assemblies) are overall forward compatible.  However, you may have issues if you build an application for one version of Outlook but use it with an older version.

More Information:

Office Developer Documentation
https://msdn.microsoft.com/en-US/office/aa905340

Office client development
https://msdn.microsoft.com/en-us/library/office/dn833103.aspx

Welcome to the Outlook 2013 developer reference
https://msdn.microsoft.com/en-us/library/office/ee861520.aspx

Outlook 2007 Developer Reference
https://msdn.microsoft.com/en-us/library/bb177050(v=office.12).aspx

How Do I ... in Outlook (2007)
https://msdn.microsoft.com/en-us/library/aa271384(v=office.11).aspx

Microsoft Office Outlook 2003 Visual Basic Reference
https://msdn.microsoft.com/en-us/library/aa271384(v=office.11).aspx

Outlook Automation is for People, not for Services.
https://blogs.msdn.com/b/webdav_101/archive/2008/09/29/outlook-automation-is-for-people-not-for-services.aspx

Known issues in Outlook 2010 when you use the object model
https://support.microsoft.com/en-us/kb/2265515
This article covers a very common scenerio which developes run into - their application and Outlook running at different elevation/integrity levels.  See the section "Cannot create Outlook.Application object from an elevated process" which states "You cannot automate Outlook by using a process that is running with elevated permissions in Windows Vista, in Windows 7, or in any other operating system that allows for running processes with elevated permissions. This is an underlying limitation of the COM. Both Outlook and custom programs that automate Outlook must be running at the same integrity level."

OOM.NET - issues with releasing memory under .NET
https://blogs.msdn.com/b/mstehle/archive/tags/oom-net/

Why is OOM code leaking items????
https://blogs.msdn.com/b/webdav_101/archive/2008/05/06/why-is-oom-code-leaking.aspx

Development : Threading with Outlook Object Model?
https://blogs.msdn.com/b/deva/archive/2010/10/13/development-threading-with-outlook-object-model.aspx

Outlook Crashes When Using Outlook Object Model in Multiple Threads
https://blogs.msdn.com/b/pcreehan/archive/2008/03/13/outlook-crashes-when-using-outlook-object-model-in-multiple-threads.aspx

HOWTO: VB/OOM - Display a message using Store ID and item ID
https://blogs.msdn.com/b/webdav_101/archive/2007/11/29/howto-vb-oom-display-a-message-using-store-id-and-item-id.aspx

How to convert Exchange Item’s EntryID to EWS unique ItemId via EWS Managed API ConvertId call?
https://blogs.msdn.com/b/brijs/archive/2010/09/09/how-to-convert-exchange-item-s-entryid-to-ews-unique-itemid-via-ews-managed-api-convertid-call.aspx

EWS Identifiers in Exchange
https://msdn.microsoft.com/en-us/library/office/dn605828(v=exchg.150).aspx

Code running against Outlook is very slow when PST or OST is on a network folder or non-physical/VHD drive
https://blogs.msdn.com/b/webdav_101/archive/2015/05/29/code-running-against-outlook-is-very-slow-when-pst-or-ost-is-on-a-network-folder-or-non-physical-vhd-drive.aspx

Selecting an API or Technology for Developing Outlook Solutions
https://msdn.microsoft.com/en-us/library/office/gg608200(v=office.14).aspx

Exchange and Outlook Development Help
https://blogs.msdn.com/b/webdav_101/archive/2015/05/28/exchange-and-outlook-development-help.aspx

Bitness:

Any CPU is best to ONLY be use pure .NET code applications and not when you have .NET code using COM objects. If you use COM components in your add-in then you need to be sure that you have builds targeted for the platform you are targeting. Not targeting for x86 or x64 may get you into trouble at deployment time. As an example if you use a 32bit COM component on a 32bit version of Windows and 32bit version of outlook while developing you will find that the code may not work on a 64bit system running 32bit version of Outlook if you compile as Any and don’t release with 64bit versions of those COM components. Any CPU will be handled as 64bit on a 64bit system and since you cannot mix 32bit COM objects in a 64bit process (or 64bit COM components in a 32bit process) the code will fail. Likewise, if you target your project as x86 and try to use it on a 64bit version of Outlook then it won’t work either.

Bitness : How to identify Outlook 2010 installation is a 32-bit or 64-bit?
https://blogs.msdn.microsoft.com/deva/2010/01/21/bitness-how-to-identify-outlook-2010-installation-is-a-32-bit-or-64-bit/

Example: Outlook 14.0 32bit under 64bit Windows 10 the bitness flag is x86 here:

  • HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Office\14.0\Outlook

Example: Outlook 14.0 32bit under 64bit Windows 10 the bitness flag is x86 here:

  • HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Office\16.0\Outlook

64-bit editions of Office 2010
https://technet.microsoft.com/en-us/library/ee681792(office.14).aspx

How to: Check the Version of Outlook
https://msdn.microsoft.com/en-us/library/office/dd941331.aspx

How to: Determine Whether Outlook Is a Click-to-Run Application on a Computer
https://msdn.microsoft.com/en-us/library/office/ff522355.aspx

Developing Outlook 2010 Solutions for 32-Bit and 64-Bit Systems
https://msdn.microsoft.com/en-us/library/office/gg549122(v=office.14).aspx

Large Examples:

Introducing OOMExplore
https://blogs.msdn.com/b/webdav_101/archive/2015/05/04/introducing-oomexplore.aspx

Other:

OutlookCode
hthttps://www.outlookcode.com/

Also see:

About: Mailbox Accessing APIs
https://blogs.msdn.com/b/webdav_101/archive/2015/05/28/about-mailbox-accessing-apis.aspx

About: VSTO for Outlook
https://blogs.msdn.microsoft.com/webdav_101/2016/08/08/about-vsto-for-outlook/

Exchange and Outlook Development Help
https://blogs.msdn.com/b/webdav_101/archive/2015/05/28/exchange-and-outlook-development-help.aspx