Developing Outlook 2010 Solutions for 32-Bit and 64-Bit Systems
Summary: Learn about developing Outlook solutions for users to run with 32-bit or 64-bit versions of Microsoft Outlook 2010.
**Applies to:**Office 2010 | Outlook 2010 | VBA
In this article
Overview
Bitness Compatibility Among Windows, Office 2010, and Outlook 2010
Default Installation Locations
Major Categories of Outlook Solutions
Managed Add-ins, and Unmanaged Applications and Add-ins for Outlook
VBA Macros for Outlook
MAPI Applications for Outlook
Conclusion
Additional Resources
Published: January 2011
Provided by: Angela Chu-Hatoun, Microsoft Corporation
Contents
Overview
Bitness Compatibility Among Windows, Office 2010, and Outlook 2010
Default Installation Locations
Major Categories of Outlook Solutions
Managed Add-ins, and Unmanaged Applications and Add-ins for Outlook
VBA Macros for Outlook
MAPI Applications for Outlook
Conclusion
Additional Resources
Overview
The article first explains basic concepts of bitness compatibility relationships among Windows, Microsoft Office 2010, and Microsoft Outlook 2010, and default installation locations for Office 2010. It then describes the major types of Outlook solutions, and points out what developers have to do (if anything) to upgrade solutions to be compatible with the bitness of the installed Outlook 2010. Because developing Outlook solutions is a very broad subject, the article collects information from various sources, and points to some of these locations for more information.
Bitness Compatibility Among Windows, Office 2010, and Outlook 2010
This section explains the compatibility of the bitness of Windows, Office 2010, and Outlook 2010. The term bitness refers to the distinction between 32-bit and 64-bit processor architectures and the associated compatibility of applications. In this article, bitness is used to qualify the version of Windows, Office, Outlook, or an application built to suit a 32-bit or 64-bit processor architecture of a computer. Each Office 2010 application is available in a 32-bit version and 64-bit version. For Outlook 2010, the bitness of Outlook that you can install on a computer depends on the bitness of Windows and the bitness of any other Office application that is already installed on that computer. Table 1 and the following list explain the dependencies:
On a 32-bit Windows operating system, you can install only 32-bit Office (and 32-bit Outlook).
On a 64-bit Windows operating system, you can install either 32-bit Office (and 32-bit Outlook), or 64-bit Office (and 64-bit Outlook). The default installation of Office 2010 on 64-bit Windows is 32-bit Office (and 32-bit Outlook).
If another Office 2010 application is already installed on a computer, the bitness of Outlook 2010 that you install must be consistent. For example, if 32-bit Microsoft Excel 2010 is already installed on a computer, you can install only 32-bit Outlook 2010 on that computer. Similarly, if 64-bit Microsoft Word 2010 is already installed on a computer, you can install only 64-bit Outlook 2010.
Table 1. Bitness dependencies
Dependency 1: Bitness of Windows |
Dependency 2: Bitness of existing Office 2010 applications |
Supported bitness of Outlook 2010 |
---|---|---|
32-bit |
32-bit |
32-bit |
64-bit |
32-bit (default installation) or 64-bit |
32-bit (default installation) or 64-bit, if no other Office 2010 application is already installed on the same computer; 32-bit if Dependency 2 is 32-bit, 64-bit if Dependency 2 is 64-bit. |
Default Installation Locations
The following are the default installation locations for Office 2010:
For a computer that is running 32-bit Windows, the default installation location for Office 2010 is C:\Program Files\Microsoft Office\Office14\.
For a computer that is running 32-bit Office on 64-bit Windows, the default installation location is C:\Program Files (x86)\Microsoft Office\Office14\.
For a computer that is running 64-bit Office, the default installation location is C:\Program Files\Microsoft Office\Office14\.
Table 2 shows the default installation location of Office 2010 per the bitness of Windows.
Table 2. Installation locations
Bitness of Windows |
32-bit Office 2010 installation location |
64-bit Office 2010 installation location |
---|---|---|
32-bit |
C:\Program Files\Microsoft Office\Office14\ |
Not supported |
64-bit |
C:\Program Files (x86)\Microsoft Office\Office14\ |
C:\Program Files\Microsoft Office\Office14\ |
Major Categories of Outlook Solutions
Outlook solutions fall into several major categories, as follows:
Add-ins written in managed languages (such as C# or Visual Basic), or stand-alone applications and add-ins written in unmanaged languages (such as C++ or Visual Basic 6.0). Note that Microsoft no longer supports Visual Basic 6.0.
Macros written in Visual Basic for Applications (VBA).
Messaging API (MAPI) applications, typically written in C++.
The following sections describe the bitness-related issues that developers of each category of Outlook solution have to be aware of when planning solutions for Outlook 2010.
Managed Add-ins, and Unmanaged Applications and Add-ins for Outlook
The way to call the Outlook object model remains basically the same, regardless of whether the add-ins are going to be run on a 32-bit or 64-bit version of Outlook 2010. However, there are changes to the Outlook object model that you should be aware of if you are adapting an existing solution to Outlook 2010. These changes apply to managed solutions that use the Outlook Primary Interop Assembly (PIA), or unmanaged solutions that call the object model directly. For more information about these changes, see the note at the end of this section.
Managed Add-Ins
You do not have to recompile existing (32-bit) managed add-ins, if you expect the add-ins to continue running only on computers that have 32-bit Outlook installed.
If you built an existing managed add-in with Microsoft Visual Studio Tools for Office, and the add-in may run on a computer that has 64-bit Outlook installed, the add-in must meet the following criteria:
You built the add-in by using Microsoft Visual Studio Tools for the Microsoft Office system 3.0, or Microsoft Visual Studio 2010 中的 Office 開發工具.
You set the Any CPU option for target platform on the Build tab of the Project Properties dialog box.
Add-ins that are built by using the preceding criteria work for both 32-bit and 64-bit versions of Office 2010. If you specified another target platform on Visual Studio, rebuild your managed add-ins by using the specified target platform so that they will run on computers that have either 32-bit or 64-bit Outlook 2010 installed. If you built your managed add-in by using the COM shim, be sure that the bitness of the COM shim matches the bitness of the target installed version of Outlook, and rebuild the managed add-in by using a 64-bit COM shim if the add-in is expected to run on a computer that has 64-bit Outlook.
Unmanaged Applications or Add-Ins
You do not have to recompile existing (32-bit) unmanaged add-ins if you expect the add-ins to continue running only on computers that have 32-bit Outlook installed.
An existing unmanaged stand-alone application (an .exe file) that runs outside the Outlook process written for 32-bit Outlook does not require recompilation for 64-bit Outlook, as long as the application interacts with Outlook by using the Outlook object model and not MAPI. (For MAPI applications, see the section MAPI Applications for Outlook later in this topic.) COM manages the marshaling between the 32-bit application and 64-bit Outlook.
However, if you expect that an existing unmanaged add-in will be run on computers that have 64-bit Outlook 2010, you must recompile the add-in for 64-bit Outlook 2010. To clarify, you will support one version of the add-in to run on 32-bit Outlook, and another version of the add-in to run on 64-bit Outlook. Because there is no 64-bit Visual Basic 6.0 runtime, existing unmanaged add-ins that were written in Visual Basic 6.0 and have to run on 64-bit Outlook 2010 should be rewritten (for example, as a managed add-in in Visual Basic).
注意
You make calls the same way whether you are targeting an add-in to run on 32-bit Outlook 2010 or 64-bit Outlook 2010. However, there are changes in the Outlook 2010 object model, as shown in the following list, that you must be aware of if you adapt an existing add-in to use the Outlook 2010 object model:
-
Object model calls in previous versions of Outlook were based on the assumption that there was only one Microsoft Exchange account per profile. This assumption is incorrect in Outlook 2010, because there can be multiple Exchange accounts per profile.
-
Existing add-ins that modify a command bar or use Application events for shortcut menus may not work as expected in Outlook 2010. Update these add-ins to use the Microsoft Office Fluent 使用者介面 extensibility. For more information, see 擴充 Outlook 2010 中的使用者介面.
For more information about object model changes and developer issues for upgrading solutions to Outlook 2010, see Developer Issues When Upgrading Solutions to Outlook 2010 (Outlook).
VBA Macros for Outlook
If you have existing macros written for 32-bit Outlook, and you intend to enable users to run the macros on 64-bit Outlook 2010, you will have to do the following:
Recompile the macros by using Visual Basic for Applications 7.0 (VBA 7).
Use conditional compilation to guarantee backward compatibility, as well as compatibility with 64-bit Outlook.
Update any Declare statements, as well as address pointers and window handles in user-defined types that are used by Declare statements.
If your macros use any ActiveX controls, update these ActiveX controls for 64-bit Outlook.
For more information, see 32 位元和 64 位元版本的 Office 2010 相容性.
MAPI Applications for Outlook
If your existing 32-bit MAPI application will run on a computer that has 32-bit Outlook installed, there is no specific action necessary.
If you need your existing 32-bit MAPI application to run on a computer that has 64-bit Outlook installed, you will have to rebuild your 32-bit application as a 64-bit application. Outlook 2010 provides a set of MAPI header files that support MAPI applications to work with both 32-bit and 64-bit Outlook 2010. Be sure that you download these header files from Outlook 2010: MAPI Header Files and rebuild your MAPI application by using the header files.
In general, the bitness of the MAPI application must be the same as the bitness of the MAPI subsystem on the computer on which the application will run. The bitness of the MAPI subsystem, in turn, is determined by and always the same as the bitness of the installed version of Outlook. Therefore, if you plan to develop a MAPI application that will be run on computers that have either a 32-bit or 64-bit version of Outlook 2010 installed, you will have to build two separate versions of the application: one to work with 32-bit Outlook, and one to work with 64-bit Outlook. For more information about MAPI support for 64-bit Outlook, see Building MAPI Applications on 32-Bit and 64-Bit Platforms.
Aside from rebuilding MAPI applications, sometimes you need to check the version of Outlook to ensure that a MAPI application calls API elements that the currently running version of Outlook supports. To learn how to check the version of Outlook and whether the installed version of Outlook is 64-bit Outlook 2010, see How to: Check the Version of Outlook.
Also, to learn how to decipher Outlook version information and the expected values for different parts of a version string, see How to determine Outlook version information.
When you plan to build or rebuild a MAPI application, be aware that you cannot call MAPI from a managed solution. This is because MAPI was designed and developed with unmanaged code before the Microsoft .NET Framework existed, and third-party managed wrappers for MAPI may be unreliable. For more information, see The support guidelines for client-side messaging development.
Conclusion
To upgrade an existing solution to Outlook 2010, first you have to be aware of object model changes and make appropriate changes in your solution. If your existing solution—whether it be a managed add-in, unmanaged stand-alone solution, unmanaged add-in, VBA macro, or a MAPI application—is expected to run only on a computer installed with 32-bit Outlook, no additional action is necessary. On the other hand, except for unmanaged stand-alone solutions, if the solution is expected to run on a computer that has 64-bit Outlook 2010 installed, there are specific steps that you must to take to prepare these solutions. Depending on the type of solution, the steps may involve downloading appropriate MAPI header files, rewriting VBA code, and rebuilding the solution.
Additional Resources
Outlook 2010 Primary Interop Assembly Reference
Outlook 2010 Developer Reference
Outlook 2010 Object Model Changes Since Earlier Versions
Visual Basic for Applications Language Reference for Office 2010
Outlook 2010 MAPI Reference