vb.net Outlook Interop (Inbox item types) How many are there and how to tell difference?

R

Roger

I have a program that goes through an outlook inbox.

Dim myItem as Outlook.MailItem

For i = 1 to items.count
myItem = myolap.items(i)
...
....
....
Next

I get a cast error exception when I get to a "Undeliverable:" in the inbox.
How do I look at the type of item before assigning?

Also what type is an Undeliverable?

Thanks,

Roger
 
S

Sue Mosher [MVP-Outlook]

It's a ReportItem. You should never assume that all the items in any Outlook folder are the same item type. You can use TypeOf to determine the type of a generic Object variable, then cast to a specific variable appropriately.
 

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