Recommendation on Outlook PIA version

Add-in Express™ Support Service
That's what is more important than anything else

Recommendation on Outlook PIA version
 
Esteban Astudillo




Posts: 146
Joined: 2006-02-27
Hi there,

I was looking at the Outlook Toys (OLToys) project example and wanted to use the code that handles selecting items in the explorer. I created my own Add-in for Outlook and after I copied the code I get an error in the selection.Item(1) call included in the example. It complains the Item method is not part of the Microsoft.Office.Interop.Outlook._Explorer.Selection class.

Then I noticed that the OLToys project was referencing a different “Outlook” assembly that I had. The one created by the wizard is coming from a local folder in my project with the Office PIA’s called Microsoft.Office.Interop.Outlook version 11.0.0.0, whereas the one in OLToys was in the bin/Debug folder of the project called Interop.Outlook version 9.0.0.0.

I tried referencing that last assembly to my project and the error message with the Selection went away, but then I got other errors with missing properties that were working before (for example MailItem.BodyFormat doesn’t exist in the 9.0 version)

So, by now you would realize that I have no much experience working with different versions of Outlook :) , so I was hoping to get some advice on which one I should use if want maximum compatibility. I suspect the answer is 9.0, but then what would I be missing. Also, how can I tell the wizard to use the 9.0 version instead of 11.0? Can I just use the one in the OLToys project?

Thanks in advance for your recommendations
Posted 03 Mar, 2006 10:16:35 Top
Sergey Grischenko


Add-in Express team


Posts: 7228
Joined: 2004-07-05
Hi Esteban.

Yes, you should use PIAs for Office 2000 (v9.0) to support all versions of Outlook. You can use interop assemblies from the OLToys project if you wish. If you want to create PIAs for Office 2000 yourself, you should do it on a PC with Office 2000 installed. It can be done via the ADX Wizard or the tlbimp.exe tool from .NET SDK.

As to the BodyFormat property, try the following code.
int bf = (int)MailItem.GetType().InvokeMember("BodyFormat", BindingFlags.GetProperty, null, MailItem, null);
Posted 06 Mar, 2006 06:52:10 Top
Esteban Astudillo




Posts: 146
Joined: 2006-02-27
Thank you for the recommendation and the code Sergey. It works nicely..

Posted 07 Mar, 2006 14:09:21 Top