473,387 Members | 1,344 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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

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
1 3875
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Nathan Carroll | last post by:
Why am I able to use this in Outlook and not do the same from .Net. My problems centers around the Items in the xp version of below i used the interop references. Does something similar exist for...
3
by: John | last post by:
Hi I am trying to access outlook contacts folders and delete the contacts that do not contain a certain category value in the categories field. I have written the below code but am stuck with...
8
by: Li Pang | last post by:
Hi, I used following codes to pass a message item from CDO to Outlook. They worked fine when I used outlook 2000, but get an error of "Specified cast is not valid." when I used Outlook 2003....
2
by: msielski | last post by:
I am posting this here since I don't see an Outlook programming group specific to .net but only VBA. Please let me know if I'll have better luck posting elsewhere. I am writing a VB.NET...
1
by: =?Utf-8?B?cm9i?= | last post by:
C#.Net Outlook 2003 automation (programmatically) with Office.Interop.Outlook Problem: I have my outlook 2003 configured with multiple mailbox on my local machine. I want to specify the mailbox...
1
by: allbelonging | last post by:
C#.Net Outlook 2003 automation (programmatically) with Office.Interop.Outlook Problem: I have my outlook 2003 configured with multiple mailbox on my local machine. I want to specify the mailbox...
0
by: Mike P | last post by:
I am switching some code from using a reference to Outlook 10 to Outlook 11, but it is breaking some code where I was referring to an inbox items collection and trying to get at an individual item...
2
by: Mike P | last post by:
I am switching some code from using a reference to Outlook 10 to Outlook 11, but it is breaking some code where I was referring to an inbox items collection and trying to get at an individual item...
0
by: =?Utf-8?B?UGF1bEg=?= | last post by:
Hi, I am writing an application which (on user request) scans the Outlook inbox for messages and other items which are relevant in the user defined context. There are several code examples...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.