Loop through selected items in C#???

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
 
T

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top