Loop through selected items in C#???

  • Thread starter Thread starter TC
  • Start date Start date
T

TC

Hey All,

Does anyone know how to do the following in C#? I've tried using the
"GetType().ToString()" method and it only returns "System._COMObject".

' The objOutlookItem is of type object because the selection object
' may contain multiple types of items (i.e. AppointmentItem, MailItem,
etc.)
For Each objOutlookItem In g_objThisAddIn.OutlookExplorer.Selection
Select Case TypeName(objOutlookItem)
Case g_constrMAIL_ITEM
' Do something
Case g_constrCONTACT_ITEM
' Do something
End Select
Next objOutlookItem

Thanks in advance.

TC
 
Hey Gabriel,

Hmmm. Very interesting.

I ended up solving by simply trying to cast the object and, if successful, I
knew what I had.

Thanks for the tip.

Regards,

TC
 
Back
Top