What type of item is a "read notification" in visual basic

Posted on 2004-04-05
Medium Priority
Last Modified: 2010-04-08
I am using visual basic to gather information from Outlook and store it in an MS Access application.
I can loop through say my Inbox and using code like:

    Dim Olapp As Outlook.Application
    Dim Olmapi As Outlook.NameSpace
    Dim Olfolder As Outlook.MAPIFolder
    Dim OlItems As Outlook.Items
    Dim olMail As Outlook.MailItem
    Dim strBody As String
    Set Olapp = CreateObject("Outlook.Application") 'Connect to outlook "Inbox" folder
    Set Olmapi = Olapp.GetNamespace("MAPI")
    Set Olfolder = Olmapi.GetDefaultFolder(olFolderInbox)
    For Each olMail In OlItems  
    strBody = olMail.Reply.Body  
    MsgBox strBody

Not a perfect example, but I hope it explains what I am doing.
This "reads" ordinary mail items perfectly.
But when it comes across a read or delivery notification, whos icon is not a small envelope, but check mark in a circle with a wave of lines after it, first it produces an error which is fine to get around, but I do want to "read" these notifications.

What type of items are these delivery/read notifications with the different icons to the envelope, and what is the visual basic code to "read" them.

Many thanks

Question by:richardhubbard
  • 3
LVL 11

Expert Comment

ID: 10763861
It's a ReportItem.
LVL 11

Accepted Solution

Steiner earned 2000 total points
ID: 10763876
Try this code (I use Object instead of a specific item type to get all of them):
 Sub Test()
    Dim Olapp As Outlook.Application
   Dim Olmapi As Outlook.NameSpace
   Dim Olfolder As Outlook.MAPIFolder
   Dim strBody As String
   Dim OlItem As Object
   Set Olapp = CreateObject("Outlook.Application") 'Connect to outlook "Inbox" folder
   Set Olmapi = Olapp.GetNamespace("MAPI")
   Set Olfolder = Olmapi.GetDefaultFolder(olFolderInbox)
   For Each OlItem In Olfolder.Items
      If OlItem.Class = olMail Then
         strBody = OlItem.Reply.Body
         Debug.Print strBody
      ElseIf OlItem.Class = OlReport Then
         Debug.Print OlItem.Subject
      End If
   Next OlItem
 End Sub

Author Comment

ID: 10772406

Thanks for your prompt reply and yes this is perfect.

Why is it when you just do not know the answer or where to starting looking, it is so difficult to find out, but when you know someone who does it is so straightforward.

LVL 11

Expert Comment

ID: 10774838
Thanks for the grade and the points ;-)

You're right it can be difficult when you don't know where to start looking. I found it quite useful to have a look at the object-catalog (by pressing F2 in the VBA-IDE), start from the last know position (in this case maybe MAPIFolder.Items) and try to guess an object that sound like it could fit, sometimes it really does so!

But then again, if you do so very succesful, where should I get my points from ;-)))

Featured Post

Easily manage email signatures in Office 365

Managing email signatures in Office 365 can be a challenging task if you don't have the right tool. CodeTwo Email Signatures for Office 365 will help you implement a unified email signature look, no matter what email client is used by users. Test it for free!

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Organisation is organized in a pattern to flow the day to day business, every application and system is interdepended on each other and when very important “Exchange Server downtime” happened.
If there is anything erroneous with Exchange Database, it causes a significant effect on email communication till the user remounts the database. Further, database crash directly affects Outlook users due to which they are unable to access their ema…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Watch the video to know how one can repair corrupt Exchange OST file effortlessly and convert OST emails to MS Outlook PST file format by using Kernel for OST to PST converter tool. It can convert OST to MSG, MBOX, EML to access them. It can migrate…

622 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question