Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

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

Posted on 2004-04-05
4
243 Views
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
    Next

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

Richard
0
Comment
Question by:richardhubbard
  • 3
4 Comments
 
LVL 11

Expert Comment

by:Steiner
ID: 10763861
It's a ReportItem.
0
 
LVL 11

Accepted Solution

by:
Steiner earned 500 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
0
 
LVL 1

Author Comment

by:richardhubbard
ID: 10772406
Greetings

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.

Thanks
0
 
LVL 11

Expert Comment

by:Steiner
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 ;-)))
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Outlook Free & Paid Tools
When you have clients or friends from around the world, it becomes a challenge to arrange a meeting or effectively manage your time. This is where Outlook's capability to show 2 time zones in one calendar comes in handy.
Many of my clients call in with monstrous Gmail overloading issues with Outlook. A quick tip is to turn off the All Mail and Important folders from synching. Here is a quick video I made to show you how to turn off these and other folders in Gmail s…
CodeTwo Sync for iCloud (http://www.codetwo.com/sync-for-icloud?sts=6554) automatically synchronizes your Outlook 2016, 2013, 2010 or 2007 folders with iCloud folders available via iCloud Control Panel. This lets you automatically sync them with…

809 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