Welcome to MSDN Blogs Sign in | Join | Help

Developing Outlook 2010 Solutions for 32-bit and 64-bit Systems

This post captures and summarizes information about developing an Outlook solution for customers who run 32-bit and 64-bit versions of Outlook 2010. Since developing Outlook solutions is a very broad subject, the article gathers information from various sources, and points to some of these locations for further details.

Bitness Compatibility Between Windows and Office 2010

Let’s first talk about the compatibility of the bitness of Windows, Microsoft Office, and Microsoft Outlook. The term “bitness” refers to the distinction between 32-bit and 64-bit processor architectures and the associated compatibility of applications. In this blog, “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 depends on the bitness of Windows and the bitness of any other Office application that is already installed on that computer. Here are the dependencies:

·         On a 32-bit Windows operating system, you can only install 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 some other Office 2010 application is already installed on a computer, then the bitness of Outlook 2010 that you will install must be consistent. For example, if a 32-bit Excel 2010 is already installed on a computer, you can only install 32-bit Outlook 2010 on that computer. Similarly, if a 64-bit Word 2010 is already installed on a computer, then you can only install 64-bit Outlook 2010.

Default Installation Locations

The following are the default installation locations when you install Office 2010:

·         For a computer running 32-bit Windows, typically the location is C:\Program Files\Microsoft Office\Office14\.

·         For a computer running 32-bit Office on 64-bit Windows, typically the location is C:\Program Files (x86)\Microsoft Office\Office14\.

·         And, for a computer running 64-bit Office, typically the location is C:\Program Files\Microsoft Office\Office14\.

Major Categories of Outlook Solutions

Outlook solutions fall into a few major categories:

·         Add-ins written in managed languages (such as C# or Visual Basic) or 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 written in typically C++.

The following sections describe the issues that developers of each category of Outlook solutions have to be aware of when planning the availability of their solutions for Outlook 2010.

Managed and Unmanaged Add-ins for Outlook

Basically, the way to call the Outlook object model remains the same*, regardless of whether the add-ins are going to be run on a 32-bit or 64-bit version of Outlook 2010.

You do not need to recompile existing (32-bit) managed or unmanaged add-ins, if you expect the add-ins to continue to run only on computers with 32-bit Outlook installed.

However, if you expect any existing unmanaged add-in or standalone application (in .exe) will be run on computers with 64-bit Outlook 2010, you must recompile the add-in or application for 64-bit Outlook 2010. To clarify, you will have one version of the add-in or application to run on 32-bit Outlook, and another version of the add-in or application to run on 64-bit Outlook. Because there is no 64-bit Visual Basic 6.0 runtime, existing unmanaged add-ins written in Visual Basic 6.0 targeting to run on 64-bit Outlook 2010 should be rewritten, for example, as a managed add-in in Visual Basic.

As for existing managed add-ins, make sure that you have built them using Microsoft Visual Studio Tools for the Microsoft Office system 3.0, or Microsoft Office development tools in Visual Studio 2010, with the Any CPU option for target platform on the Build tab of the Project Properties dialog box. Add-ins built with such settings work for (both 32-bit and) 64-bit versions of Office 2010. If you used other settings, rebuild your managed add-ins using the specified settings so that they will run on computers with either 32-bit or 64-bit Outlook 2010 installed.

*Note that even though you make calls the same way if you are targeting an add-in to run on 32-bit Outlook 2010 vs 64-bit Outlook 2010, there are changes in the Outlook 2010 object model such that, if you adapt an existing add-in to use the object model of Outlook 2010, you must be aware of the following:

·         Object model calls in previous versions of Outlook were based on the assumption that there was only one Exchange account per profile. This assumption is not correct in Outlook 2010, since 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 Office Fluent user interface extensibility. For more information, see Extending the User Interface in Outlook 2010.

 

VBA Macros for Outlook

If you have existing macros written for (32-bit) Outlook, and you intend to allow users to run the macros on 64-bit Outlook 2010, you will have to recompile the macros using Visual Basic for Applications 7.0 (VBA 7), and use conditional compilation to assure backward compatibility as well as compatibility with 64-bit Outlook. You will need to update any Declare statements, as well as address pointers and window handles in user-defined types used by Declare statements. If your macros use any ActiveX controls, these ActiveX controls will have to be updated for 64-bit Outlook as well. For more details, see Compatibility Between the 32-bit and 64-bit Versions of Office 2010.

MAPI Applications for Outlook

If your existing 32-bit MAPI application is going to be running on a computer with 64-bit Outlook installed, you will need 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. Make sure you download these header files from Outlook 2010: MAPI Header Files and rebuild your MAPI application using these header files.

In general, the bitness of the MAPI application must be the same as the bitness of the MAPI subsystem on the computer that the application is targeted to run on. The bitness of the MAPI subsystem, in turn, is determined by and always the same as the bitness of the installed version of Outlook. So if you plan to develop a MAPI application that will be run on computers with either a 32-bit or 64-bit version of Outlook 2010 installed, you will need 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 it's necessary to check the version of Outlook to ensure that a MAPI application calls API elements that are supported by the currently running version of Outlook.

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 for certain released versions of Outlook, see How to determine Outlook version information.

 

 

 

Want More Office2010 Developer Content?

Office 2010 BetaErika Ehrli Cabral has great post about all of the new content we've published to help you get started with Office 2010 development. She also has links to the downloads so you can get the Beta!

http://blogs.msdn.com/erikaehrli/archive/2009/11/18/getting-started-with-office-2010-development.aspx

 

Posted by dhale | 0 Comments

Accessing Outlook Developer Help During the Office 2010 Beta Period

The help model in Microsoft Office 2010 for Office client applications such as Access, Excel, Outlook, and Word has remained the same as in Office 2007: when you click F1, you can choose to access help that is installed on your computer, or help available on the Office Web site.

During the Office 2010 Beta timeframe, you can access developer help only from the computer; online developer help from the Office Web site will be set up when Office 2010 RTMs. What all of this means is that when you click F1 to view help in a client application, you should make sure that Developer Reference is selected under Content from This Computer in the drop-down menu adjacent to Search.

In Outlook 2010 Beta, you may notice very slight discrepancies between the objects and members displayed in the object browser, and the objects and members described in the developer help that is installed on your computer by Outlook 2010 Beta. This is because the installed help was a snap shot of the developer help taken after the cut-off date for the Beta version of Outlook 2010. Even though there are some discrepancies, this version of the developer help is reasonably sufficient to provide what you need to know to use the new object model members in Outlook 2010 Beta.

The Office Developer Documentation team has made available even more recent versions of the developer help for Access, Excel, Outlook, PowerPoint, Project, Publisher, Visio, and Word. You can download these developer references at Office 2010: Developer References. These versions of developer help are more recent snap shots, and similar to the developer help installed by Office 2010 Beta, you are likely to find discrepancies between the objects and members displayed in the object browser of the Beta product, and the objects and members described in the downloaded version of the help. Nonetheless, this downloadable help may still change between now and when Office 2010 RTMs. Meanwhile, if you are developing a solution to test against an Office 2010 Beta product, you can refer to the installed or downloadable help to learn about the product, and implement your solution based on the Beta product.

So how do you view the versions of help that you obtain by downloading? The help files are in the same .HxS file format that shipped with Office 2007 and Office 2010 Beta. For example, an Outlook developer help file named outlook.dev.hxs was shipped with Outlook 2007 and Outlook 2010 Beta. The best way to view the help file is to use the client help viewer that is part of each Office client product.

Follow these steps to use the client help viewer to view the most recent version of outlook.dev.hxs that you download:

1.       Close Outlook 2010 Beta if it is open.

2.       Search for the location of outlook.dev.hxs installed by Outlook 2010 Beta. For a computer running 32-bit Windows, typically the location is C:\Program Files\Microsoft Office\Office14\1033. For a computer running 32-bit Office on 64-bit Windows, typically the location is C:\Program Files (x86)\Microsoft Office\Office14\1033. And, for a computer running 64-bit Office, typically the location is C:\Program Files\Microsoft Office\Office14\1033.

3.       Rename that copy of outlook.dev.hxs installed by Outlook 2010 Beta as outlook.dev.beta.hxs.

4.       Copy the version of outlook.dev.hxs that you downloaded from Office 2010: Developer References to the location you found in step 2.

5.       Start Outlook 2010 Beta.

6.       Make sure that Developer Reference under Content from This Computer is selected for your client help viewer. You can now view the help you downloaded using the client help viewer.

To view a more recent version of the developer help that you download for any of the other Office applications listed earlier, follow the same steps 1 to 6, by first closing that application, replacing the installed version of the help file by the version you downloaded, and restarting the application. Make sure that you have specified Developer Reference under Content from This Computer for the client help viewer in that application.

For Outlook 2010 Beta, other than the developer reference, you can also view new technical articles on MSDN:

·         What's New for Developers in Outlook 2010. This article provides a comprehensive list of new features in the Outlook 2010 object model. 

·         Extending the User Interface in Outlook 2010. This article describes the numerous new ways you can customize the Outlook 2010 user interface in the Office Fluent ribbons, menus, context menus, and Office Backstage view. This article includes a sample add-in as a download.

·         Programming the Outlook 2010 Solutions Module. This article elaborates on the much demanded new APIs in the object model to allow add-ins to customize the Navigation Pane under a new Solutions module. This article includes a sample add-in as a download.

·         Shutdown Changes for Outlook 2010 Beta. This article describes important shutdown changes in Outlook 2010 Beta for add-in developers and IT administrators to ensure that Outlook shuts down quickly and consistently.

·         Developing an Outlook Social Connector Provider. This article describes how to implement an Outlook Social Connector (OSC) provider that connects a third-party social or professional networking site with a user in Outlook, and allows the user to view social network data from that site without having to leave Outlook. This article includes a sample provider as a download.

The first three of these technical articles provide details and code samples in addition to related content in the Outlook 2010 Developer Reference. The last two articles currently offer the only source of documentation in their respective subject areas.

 

Developer Help Updates for Office 2010 Beta

In the intervening time between when we had to hand-off the Developer References to go into the Office 2010 Beta several weeks ago and now, the Office Developer Documentation team has been extremely busy adding new content about the new features. We have added hundreds of new topics to the references!

This post describes to Office VBA developers how to make sure they are viewing the most up to date version of the developer help for the Office 2010 client applications.

Please Pardon Our Dust!

imageAs we gear up for the release of Office 2010, we are excited about the improvements we are making to how we deliver content updates via the Office Web site. However, as a result of that work, for the Beta we are only able to provide developer help in the “offline” mode (that is, the content is viewed locally from your hard drive). Don’t worry though, online refreshes of the developer help content will be up and running for the final release of Office 2010!

How to Update Developer Help

If you are a VBA developer and would like to have the latest Office 2010 Beta developer reference, just follow the steps below to update. These steps describe how to download the latest files (.HxS files), install them, and view them.

1. Download the reference(s) from Office 2010: Developer References and extract them to a location on your computer. The download contains help builds for the following developer help content:

  • Combined Office 2010 developer references (All of the below)
  • Access 2010 Developer Reference (MSACCESS.DEV.HXS)
  • Excel 2010 Developer Reference (EXCEL.DEV.HXS)
  • Outlook 2010 Developer Reference (OUTLOOK.DEV.HXS)
  • PowerPoint 2010 Developer Reference (POWERPNT.DEV.HXS)
  • Project 2010 Developer Reference (WINPROJ.DEV.HXS)
  • Publisher 2010 Developer Reference (MSPUB.DEV.HXS)
  • Visio 2010 Automation Reference (VISIO.DEV.HXS)
  • Visio 2010 ShapeSheet Reference (VISIO.SHAPSHEET.HXS)
  • Word 2010 Developer Reference (WINWORD.DEV.HXS)

2. Make sure to close any open Office 2010 Beta applications.

3. Copy the extracted HxS file(s) into the directory where Office 2010 Beta installed them. For a computer running 32-bit Windows, typically the location is:


  C:\Program Files\Microsoft Office\Office14\1033

  For a computer running 32-bit Office on 64-bit Windows, typically the location is

  C:\Program Files (x86)\Microsoft Office\Office14\1033

  You should overwrite the existing versions of the files.

Viewing the Updated Help

Start the application for which you have updated the developer help file. Press F1 to open the client help viewer.

Make sure that you are viewing the local copy of help by ensuring that Developer Reference under Content from This Computer is selected for your client help viewer (shown below). You can now view the help you downloaded using the client help viewer.

image

Tip: Make sure you display the Tablet of Contents by clicking the little book icon in the toolbar of the client help viewer. It makes browsing the developer help much more intuitive.

A Final Note

In addition to the developer help, you can find dozens of articles, code samples, videos, and more showing you how to work with the awesome developer features in Office 2010 Beta on the Office Developer Center.

Outlook 2010 MAPI Reference Refreshed on MSDN

The Microsoft Outlook 2010 MAPI Reference has been updated on MSDN! The updated documentation is also available as a download.

This release includes documentation for the binary stream structure for the PidLidPropertyDefinitionStream property. This property specifies definitions of all custom fields and data-binding settings for built-in fields of an Outlook item.

There is now a code sample in How to: Check the Version of Outlook that shows how to check version information of an installed version of Microsoft Outlook, if the installed version is Outlook 2010, Outlook 2007, or Outlook 2003. The code sample also returns a pointer to a Boolean variable that indicates whether a 64-bit version of Outlook is installed.

MAPI provider code samples for Outlook 2010 are also available at the Outlook 2010 MAPI Code Samples Web site. These code samples support 64-bit MAPI. The link in the Outlook 2010 MAPI Reference currently still points to the Outlook 2007 set of MAPI provider code samples, but will be updated the next time the documentation is refreshed on MSDN.

New features in Outlook 2010!

On July 13, Microsoft announced that Microsoft Office 2010 reached the Technical Preview engineering milestone. Even though the Office 2010 Technical Preview bits and most of the documentation are available to only participants of the Technical Preview program, we're excited to be able to start blogging about new features and documentation.

The Outlook 2010 MAPI Reference (Technical Preview) is one of the first Office 2010 developer references made available to the general public at this milestone. This release of the Outlook MAPI Reference includes documentation for API elements updated for 64-bit MAPI, and a download for Outlook 2010 MAPI header files. If you plan to have existing 32-bit MAPI applications or new MAPI applications running on a 64-bit operating system with 64-bit Outlook, you will need to build your MAPI applications as 64-bit applications with these header files. Other new content in this release includes fast shutdown support for MAPI clients, 38 new properties, and how to link explicitly to MAPI functions. A summary of new features is in What's New in This Edition.

Apart from Outlook 2010 MAPI, Outlook 2010 offers new features in the object model in the Technical Preview release. Some of the major OM features include the following:

  • A new Conversation object that groups Outlook items that belong to the same "thread" across folders and stores. The Conversation object provides methods to navigate and enumerate items in a conversation hierarchy, and access items in a conversation with a new light-weight SimpleItems collection. You can also programmatically manage the assigning of categories, marking items as read or unread, and cleaning up of a conversation in ways similar to that offered in the Outlook user interface.
  • A new SolutionsModule object that allows Outlook applications to expose a set of one or more folders in the Navigation Pane under the new navigation module, Solutions. There is only one Solutions module that all applications share. When the Solutions module shows folders for only one application, the label can be customized, for example, changed from the default label Solutions to Marketing Project. The Solutions module shows folders from each application in its own grouping. Each application has a corresponding solution root folder in the Solutions module. Subfolders can contain items of different item types. One rule is that a solution root folder and its subfolders must reside on the same store. If the solution root folder is the root folder of a store, then all subfolders of the store root folder are displayed under the solution root folder.
  • A new MobileItem object that represents an SMS or MMS message and supports incorporating mobile messages into Outlook applications. Even though the MobileItem object does not have the full functionality as other Outlook items such as the MailItem object, you can programmatically create a MobileItem object, specify the recipients, subject, and message content, and send the MobileItem object using a specific Outlook Mobile Services account.
  • Extensions to the Account object that supports multiple Exchange accounts.
  • Ability to programmatically customize the Outlook user interface in the following areas:

* Explorer Ribbons
* Inspector Ribbons
* Menus
* Context menus
* Contact Card context menus
* Backstage view
You can customize these areas using Ribbon extensibility, and supply Ribbon XML to the GetCustomUI method of the IRibbonExtensibility interface. Use the Ribbon ID for the feature to determine the XML to pass as a returned value in the GetCustomUI method. Your Ribbon XML typically supplies callbacks that let you respond to a button click, or control visibility or the icon of your Ribbon controls. Use the IRibbonControl.Context object to identify the active window containing the user interface that triggers the callback procedure.

Documentation for the Solutions module and customizing Outlook user interface is currently available to participants of the Technical Preview program. Most developer documentation for Outlook 2010 new features will be available to the public before the launch of Office 2010. I will keep you all posted about further documentation availability.

New code samples in the Outlook 2007 Developer Reference!

MVP Helmut Obertanner contributed two new code samples recently in May:

  • How to: Import Appointment XML Data into Outlook Appointment Objects
  • How to: Obtain and Log On to an Instance of Outlook  

These code samples are presented in managed code (C# and Visual Basic). They are particularly interesting because they demonstrate the use of the .NET Framework Class Library together with the Outlook Primary Interop Assembly. "How to: Import Appointment XML Data into Outlook Appointment Objects" shows how to use the Microsoft COM implementation of the XML Document Object Model (DOM) to load and process appointment data in XML and return the data in Outlook AppointmentItem objects. "How to: Obtain and Log On to an Instance of Outlook" shows how to use Microsoft Language Integrated Query (LINQ) to verify if there is an Outlook process running on a computer.

You can view these code samples on the Office Online version of the Outook 2007 Developer Reference:

  1. In Outlook, click F1.
  2. Click the down arrow next to Search.
  3. Under Content from Office Online, select Developer Reference if it is not already selected.
  4. In the text box adjacent to Search, type a related search string such as "XML", "appointment", or "import" to find the topic "How to: Import Appointment XML Data into Outlook Appointment Objects".
  5. Similarly, type a search string such as "log on" or "Outlook instance" to find "How to: Obtain and Log On to an Instance of Outlook".

Starting from this update, you can select from the TOC or search for the topic "Latest Additions to the Outlook Developer Reference" to see updates to the Outlook 2007 Developer Reference in the most recent quarter. Code samples from Helmut in the last couple of months are listed there.

As usual, you can also select from the TOC or search for the topic "How Do I ... in Outlook" which lists all the how-to topics in the Outlook developer help.

 

 

MVP Helmut Obertanner contributes code samples to the Outlook Developer Reference!

I am happy to announce that MVP Helmut Obertanner became the first MVP who contributed code samples to the Outlook 2007 Developer Reference on Office Online!

The two code samples that Helmut contributed are about the Account object, published in a new topic "How to: Send an E-mail Given the SMTP Address of an Account" and in the Account Object topic. These code samples are in managed code (C# and Visual Basic), which will directly benefit Outlook developers who have switched to using managed code over the last few years.

If you would like to see these code samples, they are available in the Office Online version of the Outlook 2007 Developer Reference. To view these code samples:

  1. In Outlook, click F1.
  2. Click the down arrow next to Search.
  3. Under Content from Office Online, select Developer Reference if it is not already selected. This selection allows you to view the most current content in the Outlook 2007 Developer Reference on Office Online. This content is more up-to-date than the Outlook 2007 Developer Reference on MSDN.
  4. Type account in the text box adjacent to Search.
  5. Select the topics, “Account Object”, and “How to: Send an E-mail Given the SMTP Address of an Account” returned in the search results.

Typing other search keywords such as Helmut or MVP also returns these topics. Other than searching, developers can get to the new "How to: Send an E-mail Given the SMTP Address of an Account" topic via the following topics

  • "How Do I... in Outlook" - lists this how-to topic in the list of how-to's in the developer reference

The following reference topics also list this how-to topic in the See Also section:

  • Account object topic
  • Account.SmtpAddress property topic
  • Accounts object topic
  • MailItem object topic
  • MailItem.Body property topic
  • MailItem.Recipients property topic
  • MailItem.Subject property topic
  • MailItem.Send method topic
  • MailItem.SendUsingAccount property topic

I really appreciate Helmut's contribution, and anticipate to receive more code samples from him in the future. Go to Helmut's site at http://www.outlooksharp.de/ to find out more about his work!

BTW, at the moment, there is a small glitch on our publishing site that the URL of Helmut's site, http://www.outlooksharp.de/, is displayed not exactly as such but as the internal hyperlink we use to redirect viewers to Internet sites. Nonetheless, the hyperlink is clickable and brings viewers to Helmut's site, and our content engineering team is looking into fixing this glitch. Also, Helmut's code samples will be carried forward to the Developer Reference and Primary Interop Assembly Reference for Microsoft Outlook 2010.

Download for the Outlook 2007 MAPI Reference is now available!

You can now download the Outlook 2007 MAPI Reference from the Microsoft Download Center at http://www.microsoft.com/downloads/details.aspx?FamilyID=4b1b8b22-3c74-4479-bd0d-7b0ee29e8d59&displaylang=en!

Since my last blog post in January, it seems like the major search engines have made some progress on their crawling. When you search for some commonly used MAPI names today, like PidTagBody and IABContainer::IMAPIContainer, the more popular search engines return them on the first page of their search results. While the search engines are still working their way through the approximately 1500 APIs in the Outlook 2007 MAPI reference, you now have a choice to download this reference, install it on your computer in Compiled HTML (CHM) format, view it at your convenience, and search in this CHM file when you are not connected to the Internet.

The Outlook 2007 MAPI Reference documents about 950 properties in a considerable level of detail. The MAPI reference points you to corresponding Microsoft Exchange Server protocol documents if you need further information on most of these properties. If you often work offline, as in a controlled corporate environment, consider downloading the Exchange protocol documents and have them readily available on your computer as well. You can choose to download individual protocol documents or all of the Exchange protocol documents; currently there are 90+ documents available.

Where is the MAPI documentation?

Some internal partners and external customers have asked where to find the Messaging API (MAPI) documentation. Coincidentally, there were some updating issues on the MSDN server for a couple of days around the middle of the month, which caused corruption in the MSDN table of contents, looking for the MAPI documentation became a more frustrating experience.

The MAPI Programmer's Reference that the Microsoft Exchange Server group has supported for years on MSDN has been updated and republished as the Microsoft Office Outlook 2007 Messaging API (MAPI) Reference (http://msdn.microsoft.com/en-us/library/cc765775.aspx). About two years ago, the Exchange Server group decided that they will not continue to support the MAPI documentation. Microsoft Office Outlook, being a major MAPI client itself and having many of its customers developing MAPI solutions to work with Outlook, took over the MAPI documentation and updated it last year. The resultant documentation is the Outlook 2007 MAPI Reference, which focuses on developing MAPI solutions for Outlook 2007. There are now more current code samples and numerous additional MAPI properties. Content that is no longer relevant to Outlook 2007 has been removed. For what is new and what has changed, see What's New in This Edition.

For the next few months, if you click old bookmarks set up on a browser marking Web pages of the MAPI Programmer's Reference, you will see a short passage pointing you to the Outlook 2007 MAPI Reference and other alternative Exchange references. In the longer term, the redirection from the Exchange content to the corresponding Outlook content will be automatic. For the time being, set up and navigate using new bookmarks to the Outlook content. Some URLs have been specified in this blog for your convenience; in Internet Explorer, just right-click the link and click Add to Favorites.

As some of us are aware, new content on the Internet requires anywhere from weeks to months for search engines to crawl and index, before these search engines return this new content in customer searches. The Outlook 2007 MAPI Reference was published on December 3, 2008; if you search now, in January 2009, for specific MAPI interfaces, such as the following:

Or any of the other 30 documented MAPI interfaces or 885 MAPI properties, you probably won't see results from the Outlook 2007 MAPI Reference ranked high on the list of returned results yet. Meanwhile, the way to look for documentation for specific MAPIs is to browse the table of contents on the left navigation pane of the MSDN Library. For example, if you are looking for a reference topic on a MAPI, and you don't yet have the Outlook 2007 MAPI Reference bookmarked, expand the following nodes in the navigation pane:

  1. MSDN Library
  2. Office Development
  3. 2007 Microsoft Office System
  4. Outlook 2007
  5. Outlook 2007 MAPI Reference
  6. Reference

Should the unfortunate event of last week's MSDN server update incident happen again, causing the Outlook 2007 MAPI Reference to temporarily disappear from the table of contents, feel free to send an e-mail to o12devdx@microsoft.com. Keeping our fingers crossed, with increased use of this documentation over the next few months, finding documentation on the Outlook 2007 MAPI Reference will become more efficient.

 

MAPI Properties and the New Outlook 2007 MAPI Reference

The Outlook 2007 Messaging API (MAPI) Reference is now officially published on MSDN! If you are interested in using MAPI to develop solutions that work with Outlook, take a look!

 

Microsoft MAPI specialist Stephen Griffin already talked about a few new features in his blog, so I’ll cut that short here. Being the project manager, I see the following as the few areas we spent most effort on and hopefully, by commenting in the Community Content at the bottom of a topic, you can let us know if the effort is worth it.

·         885 MAPI properties are now documented, including 452 tagged properties, some of which were previously documented in the Exchange MAPI Programmer’s Reference, as well as 433 named properties.

·         Overhaul of legacy content to remove outdated references of technologies and to fix bugs in the previous Exchange version.

·         New code samples showing how to create various Outlook items in C++ using MAPI and cross-referencing from concept, interface, and method topics into MFCMAPI to illustrate the use of specific APIs.

Looking for Properties? 

The Outlook 2007 MAPI Reference documents the majority of the properties that you would want to use in your Outlook solution.

 

Search keywords have been set up for each property topic to facilitate your search on MSDN, Windows Live Search, and other major search engines to retrieve the appropriate property topic in the Outlook 2007 MAPI Reference. However, depending on the crawls performed by specific search engines, during the interim period which can last anywhere from 24 hours to longer, your search for a property, like PR_BODY, may not yet return any result from the Outlook 2007 MAPI Reference. Mind you, the more you reference the Outlook 2007 MAPI Reference online, like blogging or discussing about it in your online community, the sooner your search engine will bubble up the appropriate results. Nonetheless, meanwhile, to reduce frustration, you can go to this topic to map your search to the appropriate MAPI property topic: Mapping MAPI Names to Canonical Property Names.

 

By the way, there is a small set of properties that we no longer support, and you can find the list here: Properties Deprecated in This Edition.

 

You probably have noticed that we now reference properties by their new canonical property names. For example, PR_ASSISTANT is now documented in the PidTagAssistant canonical property topic, dispidCategories in PidLidCategories, and EditTime in PidNameEditTime. Canonical property names provide a consistent way to identify and group completely identical or similar properties using one canonical property name. Over the course of MAPI history, properties with the same property tag, and properties with the same property identifier, but different types, have been defined for various reasons. For example, PR_BUSINESS2_TELEPHONE_NUMBER and PR_OFFICE2_TELEPHONE_NUMBER have exactly the same property tag (that is, their property identifier and property type are the same), and PR_SENDER_NAME, PR_SENDER_NAME_A, PR_SENDER_NAME_W have the same property identifier and different types. Now these two sets of properties can be identified by the canonical properties PidTagBusiness2TelephoneNumber and PidTagSenderName respectively. Note that canonical properties are not defined as constants in officially distributed MAPI header files, and you can continue to use real property names such as PR_BUSINESS2_TELEPHONE_NUMBER and PR_SENDER_NAME in your code. For more information on canonical properties, see MAPI Canonical Properties.

 

Remember, use the MSDN Community Content feature to provide your feedback!

We Get E-mails: Where Are the Object Members?

The object model reference documentation for the Office client applications (Word, Excel, Outlook, PowerPoint, Access, etc., etc.) provides detailed information about the associated properties, methods, and events for objects that are exposed through the API of each client application. This information is crucial if you develop applications that automate the client applications. You can find this documentation on both MSDN and within the help content that appears when you press the F1 key while using the Visual Basic Editor in one of the Office client applications.

The way this documentation is structured in the table of contents (TOC) in MSDN, the topmost topic node in the TOC is the object and under the main object topic node, you'll find the nodes for the associated  properties, methods, and events.

For example, this is how Word's Document object topic and associated member topics are arranged in the TOC on MSDN:

image

From there you can easily see that there is a node to a topic ("Document Object Members") that lists all the members associated with the Document object.

But sometimes readers are not browsing the TOC. They might get to the object's main page through a link in a search result or from some other web link. The object's main page looks like this (again using the Document object as an example):

image

So we get e-mails--"Hey! Where is the list of object members?" For one reason or another, many readers end up on the main page for an object and expect to see a list of the object's members. While there isn't a list of all the object's members on this page, there is a link to the topic that shows all the members for an object. Unfortunately the link is tucked away at the bottom of the page under the See Also section, so it's easy to miss:

image

Clicking the <Object Name> Object Members link takes you to the topic that shows you all the object's members:

image

The story is similar for the "F1" help documentation. The main object topic has a link at the bottom that takes you to the topic that lists all the members for the object. Here's the Word Document Object topic in the client help viewer (note the link to the Document Object Members topic under See Also at the bottom):

image

The link then takes you to the Document Object Members topic where you can see all the objects listed:

image

Office Chart Object Model in PowerPoint and Word

With the release of Service Pack 2 (SP2) for Microsoft Office 2007, you can now programmatically access and manipulate charts using the VBA object model in Word 2007 SP2 and PowerPoint 2007 SP2. Prior to Service Pack 2, you could only access charts using the VBA object model in Excel 2007.

The chart object in Word 2007 SP2 and PowerPoint 2007 SP2 is drawn by the same shared Office drawing layer implementation used by Excel 2007, so if you’re familiar with the charting object model in Excel 2007, you can easily migrate Excel VBA code that manipulates charts into Word 2007 SP2 and PowerPoint 2007 SP2 VBA code.

In Excel 2007, a chart is represented by the ChartObject object. In Word 2007 SP2 and PowerPoint 2007 SP2, a chart is represented by a Chart object. The Chart object is contained by an InlineShape or Shape (in Word 2007 SP2) and a Shape (in PowerPoint 2007 SP2). In Word 2007 SP2, you can use the InlineShapes collection of the Document object to add new or access existing charts. In PowerPoint 2007 SP2, you can use the Shapes collection of the Slide object to add new or access existing charts. You can use the AddChart method for both collections, specifying the chart type and location within the document or slide, to add a new chart.

You can use the HasChart property to determine if an InlineShape object (InlineShape.HasChart in Word 2007 SP2) or Shape object (Shape.HasChart in PowerPoint 2007 SP2) contains a chart. If HasChart returns True, you can then use the Chart property to get a reference to a Chart object that represents the chart. At this point, the implementation is virtually identical in Excel 2007 SP2, Word 2007 SP2, and PowerPoint 2007 SP2, and VBA code can be transferred across all three programs in most cases.

For example, the following VBA code adds a new 2-D stacked column chart to the active worksheet in Excel and sets the chart’s source data to the range A1:C3 from the Sheet1 worksheet.

Excel 2007 SP2
   1: Sub AddChart_Excel()
   2:     Dim objShape As Shape
   3:     
   4:     ' Create a chart and return a Shape object reference.
   5:     ' The Shape object reference contains the chart.
   6:     Set objShape = ActiveSheet.Shapes.AddChart(XlChartType.xlColumnStacked100)
   7:     
   8:     ' Ensure the Shape object contains a chart. If so,
   9:     ' set the source data for the chart to the range A1:C3.
  10:     If objShape.HasChart Then
  11:         objShape.Chart.SetSourceData Source:=Range("'Sheet1'!$A$1:$C$3")
  12:     End If
  13: End Sub

By comparison, the following VBA code adds a new 2-D stacked column chart to the active document in Word 2007 and sets the chart’s source data to the range A1:C3 from the chart data associated with the chart.

Word 2007 SP2
   1: Sub AddChart_Word()
   2:     Dim objShape As InlineShape
   3:     
   4:     ' Create a chart and return a Shape object reference.
   5:     ' The Shape object reference contains the chart.
   6:     Set objShape = ActiveDocument.InlineShapes.AddChart(XlChartType.xlColumnStacked100)
   7:     
   8:     ' Ensure the Shape object contains a chart. If so,
   9:     ' set the source data for the chart to the range A1:C3.
  10:     If objShape.HasChart Then
  11:         objShape.Chart.SetSourceData Source:="'Sheet1'!$A$1:$C$3"
  12:     End If
  13: End Sub

Key Differences Between the Chart object in Word 2007 SP2/PowerPoint 2007 SP2 and ChartObject object in Excel 2007 SP2

The Chart object in Word 2007 SP2 and PowerPoint 2007 SP2 does have a few differences from the Excel 2007 SP2 implementation.

  • Programmatically creating or manipulating a ChartData object in Word 2007 SP2 or PowerPoint 2007 SP2 will cause Excel 2007 SP2 to run.
  • Chart properties and methods for manipulating the chart sheet aren’t implemented.
    The concept of a chart sheet is specific to Excel 2007. Chart sheets aren’t used in Word 2007 or PowerPoint 2007, so methods and properties used to reference or manipulate a chart sheet have been disabled for those applications.
  • Properties and methods that, in Excel 2007 SP2 normally take a Range object reference now take a range address in Word 2007 SP2/PowerPoint 2007 SP2.
    The Range object in Word 2007 SP2 and PowerPoint 2007 SP2 is different than the Range object in Excel 2007 SP2. To prevent confusion, the charting object model in Word 2007 SP2 and PowerPoint 2007 SP2 accepts range address strings, such as "='Sheet1'!$A$1:$D$5", in those properties and methods (such as the SetSourceData method of the Chart object) that accept Range objects in Excel 2007 SP2.
  • A new object, ChartData, has been added to the VBA object models for Word 2007 SP2 and PowerPoint 2007 SP2 to provide access to the underlying linked or embedded data for a chart.
    Each chart has, associated with it, the data used to draw the chart in Word 2007 SP2 or PowerPoint 2007 SP2. The chart data can either be linked from an external Excel workbook, or embedded as part of the chart itself. The ChartData object encapsulates access to the data for a given chart in Word 2007 SP2 or PowerPoint 2007 SP2. For example, the following VBA code displays, then minimizes, the chart data for each chart contained by the active document in Word 2007 SP2:
   1: Sub ShowWorkbook_Word()
   2:     Dim objShape As InlineShape
   3:     
   4:     ' Iterates each inline shape in the active document.
   5:     ' If the inline shape contains a chart, then display the
   6:     ' data associated with that chart and minimize the application
   7:     ' used to display the data.
   8:     For Each objShape In ActiveDocument.InlineShapes
   9:         If objShape.HasChart Then
  10:  
  11:             ' Activate the topmost window of the application used to
  12:             ' display the data for the chart.
  13:             objShape.Chart.ChartData.Activate
  14:             
  15:             ' Minimize the application used to display the data for
  16:             ' the chart.
  17:             objShape.Chart.ChartData.Workbook.Application.WindowState = -4140
  18:         End If
  19:     Next
  20: End Sub
Posted by dhale | 4 Comments

Open XML SDK 2.0 CTP Available

The Open XML SDK 2.0 Community Technology Preview (CTP) is here!

You can find the documentation for it here and the SDK download here.

Zeyad Rajabi, a Program Manager for the Open XML SDK, has begun a series of posts covering the Open XML SDK design goals and architecture, sprinkling in some sample code as he goes along.

Also, Eric White, a Microsoft Technical Evangelist, has a great write up on the new version of the SDK.

This new version of the SDK is an amazing leap forward.The Open XML SDK version 1 greatly simplified working with packages. Developers could manipulate Open XML file format compliant documents at the package and part levels using strongly typed .NET classes. To access the file formats at the element level, you still had to work directly with the underlying XML.

In the Open XML SDK version 2, the development team has taken most of the elements in the various schemas for the Open XML file formats (WordprocessingML, SpreadsheetML, PresentationML, etc., etc.) and made first-class managed objects out of them. Not to mention the fact that they've "linq-ified" the entire API so you have the power of Linq, as well.

This makes things much easier if, like me, working with XML directly isn’t your strong suit. With the Open XML SDK v2, I can work with objects that represent the XML elements instead of having to work in the underlying XML itself (although the SDK also supports LINQ to XML, as well). For instance, suppose I needed to locate the first table in a Word document. I could easily locate the first table present in the document with code like this:

   1: using (WordprocessingDocument theDoc = WordprocessingDocument.Open(location, true))
   2: {
   3:     MainDocumentPart mainPart = theDoc.MainDocumentPart;
   4:  
   5:     Table theTable = mainPart.Document.Descendants<Table>().First();

You can see the advantage of using this new version of the SDK in line 5 of the code snippet where, by specifying that I want to filter for descendants of the Document object (which represents the <w:document> element in the Microsoft implementation of the Open XML WordprocessingML) where the descendant is of type Table (that is, I want all <w:tbl> elements), I can immediately get to the tables in my Word document.  Then, by using the First() extension method, I can select the first table element in the returned list of descendant table elements. All without having to do the detailed work of traversing the underlying XML directly; the API handles the XML work for me.

Or how about trying to get to the text in a specific cell in the Word 2007 table? I’m simplifying things a great deal, but let's assume I know which cell has the data I want (the cell in the 2nd row and 1st column):

   1: TableRow theRow = theTable.Elements<TableRow>().ElementAt(1);
   2:  
   3: TableCell theCell = theRow.Elements<TableCell>().ElementAt(0);
   4:  
   5: string cellText = theCell.InnerText;
   6:  
   7: Console.WriteLine("The 2nd row, 1st cell text is {0}", cellText);

So here I just use the same technique that I used above to find elements of a given type (by using the provided generic methods) in order to find the 2nd row of the table (<TableRow>().ElementAt(1)) and the first cell (<TableCell>().ElementAt(0)). Then I just pull the value of the Cell object's InnerText property and it's done! Although there are other ways to use the SDK to get the same data, you can still see that with only a few lines of code, I'm able to do quite a bit without working directly in the underlying XML. And remember, we can do this type of manipulation WITHOUT running the client application (in this case Microsoft Word 2007).

The Office Client Developer Content team (my team) has some great examples on the MSDN web site here. Check it out!

Posted by soliver | 0 Comments
Filed under: , ,

Open XML SDK 1.0 Available

Just read fantastic news from Erika Ehrli Cabral that the Open XML SDK 1.0 is now available. She writes:

"The Open XML Format SDK Technology Preview simplifies the task of manipulating Open XML packages. The Open XML Application Programming Interface (API) encapsulates many common tasks that developers perform on Open XML packages, so you can perform complex operations with just a few lines of code. Using this API, you can programmatically generate and manipulate Word 2007 documents, Excel 2007 spreadsheets, and PowerPoint 2007 presentations. The programming model uses managed code, so it's safe for server-side scenarios.

The Open XML Format SDK also provides how-to articles and reference documentation that can help you get started with Open XML programming."

See her post for details on where to download.

More Posts Next page »
 
Page view tracker