Are Outlook read receipts considered Outlook.MailItems?

I'm trying to construct a .pst file from a bunch of .msg files. when I try to process an Outlook read-receipt this line of code:

oMail = ((Outlook.MailItem)oOutlook.Session.OpenSharedItem("c:\111234.msg"));

throws this error:

Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.Office.Interop.Outlook.MailItem'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{00063034-0000-0000-C000-000000000046}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
LVL 8
Bob HoffmanDeveloperAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mvidasCommented:
Hi HB,

I believe read receipts are considered a Outlook.ReportItem rather than MailItem.

Matt
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Helen FeddemaCommented:
mvidas is probably correct.  At any rate, I am sure they are not MailItems.  To find out exactly, you could write some code to iterate through the items in the Inbox (or another folder), and report their Subject (so you know which message is which) and Class properties to the Immediate Window.  Check the OlObjectClass enum to match up the number with the named Class constant.
0
Bob HoffmanDeveloperAuthor Commented:
It doesn't appear to be a ReportItem, it fails with the same error when I try to cast it as a ReportItem.

Helen.. that's a good idea, I'll write a little program to check the type of similar items in my own inbox.  

0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

mvidasCommented:
Odd.. I used VBA in outlook with the following code when on a read receipt:

Sub Hmm()
  MsgBox TypeName(Application.ActiveExplorer.Selection.Item(1))
End Sub

And it shows ReportItem. Not sure why your code doesn't like it though.
0
Bob HoffmanDeveloperAuthor Commented:
mvidas was correct they are ReportItems. When I casted it as a MailItem if failed, I then tried casting it aa ReportItem it also failed (with the same incorrect type error). Turns out the first cast put a lock on the file, (not sure why).. the fix was to run the gargabe collector prior to casting it a second time as a ReportItem. Thanks for the help everyone.
0
mvidasCommented:
Glad to help! I'm going to post your final resolution comment here, as others can't see it. Let us know if you need anything else!

Author Comments:
mvidas was correct they are ReportItems. When I casted it as a MailItem if failed, I then tried casting it aa ReportItem it also failed (with the same incorrect type error). Turns out the first cast put a lock on the file, (not sure why).. the fix was to run the gargabe collector prior to casting it a second time as a ReportItem. Thanks for the help everyone.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Outlook

From novice to tech pro — start learning today.