You have to handle errors, all errors, in any COM addin. In this case if
there's an error just handle it and clear the error object.
You may run into other problems trying to use CDO 1.21 from a .NET
application. It looks like your code is C# and use of CDO with the COM
Interop is not supported by MS. It might work and it might work most of the
time but you will run into things that just won't work or will fire errors.
--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm
"Bhanu" wrote in message
...
Great, That's working. Thanks alot.
But I started getting one exception while reading "Undeliverable Mails(by
System Administrator) which are in my mailbox. The exception is "Specified
Cast is Invalid".
The code I have written is below :
for(int j=1; j=folder.Items.Count; j++)
{
subjectItem = (Outlook.MailItemClass)(folder.Items[j]); //error
statement
}
but it is giving an exception mentioned above, while reading
"Undeliverable
Mails".
More help is needed on how to handle such mails........
Thanks
Bhanu