View Single Post
  #1  
Old April 1st 10, 06:18 AM posted to microsoft.public.outlook.program_addins
TTT
external usenet poster
 
Posts: 11
Default Add-in problem: Process All Marked Header doesn't display email bodies

Fixed!

if (_explorer.Selection[1] is Outlook.MailItem)

becomes

bool isMailItem = false;

Object objectToInspect = _explorer.Selection[1];

Type type = objectToInspect.GetType();

try
{
if ((Outlook.OlObjectClass)type.InvokeMember("Class", System.Reflection.BindingFlags.GetProperty, null, objectToInspect, null) == Outlook.OlObjectClass.olMail)
{
isMailItem = true;
}
}
catch (Exception ex)
{
//eat
}

if (isMailItem)


Pretty obvious, really


Thanks a lot, Ken


kenslovak wrote on Wed, 31 March 2010 09:05
So try getting the item as an Object and using Reflection to get the Class
property or MessageClass property and examine the item type that way. See if
that causes the same problem as your cast.

Ads