Article ID: 259298 - View products that this article applies to.
This article was previously published under Q259298
This article describes how to use Microsoft Outlook Object Model from Visual C++ through the #import statement and smart pointers.
The #import statement is different for each version of the Microsoft Outlook Object Library (Msoutlxx.olb).
The following code is an example of an #import statement that works with all versions of the Microsoft Outlook Object Model:
Note You must change the paths for the system, and then build your application by using the earliest version of Microsoft Outlook to avoid backward compatibility issues.
The following code is an example of how to log on to your default profile, and then print the number of messages in the Inbox folder. The following code also demonstrates how you can use the #import statements from the previous code by using smart pointers.
After you compile the project, four files are created for you by the #import statement: MsoXX.tli, MsoXX.tlh, MsoutlXX.tli, and MsoutlXX.tlh. If you manually add these files to your project, you can view all the Office and Outlook library interfaces in the ClassView class, and the IntelliSense option displays the parameters as you type the interface methods.
Article ID: 259298 - Last Review: September 9, 2005 - Revision: 3.3