By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,417 Members | 1,178 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,417 IT Pros & Developers. It's quick & easy.

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

P: n/a
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

Nov 21 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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.

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx
"Roger" <da*****@netins.net> wrote in message news:ex**************@TK2MSFTNGP15.phx.gbl...
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




Nov 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.