?
Solved

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

Posted on 2004-04-05
4
Medium Priority
?
246 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
[X]
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
  • 3
4 Comments
 
LVL 11

Expert Comment

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

Accepted Solution

by:
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
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

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

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

Large Outlook files lead to various unwanted errors and corruption issues. Furthermore, large outlook files can also make Outlook take longer to start-up, search, navigate, and shut-down. So, In this article, i will discuss a method to make your Out…
In this step by step procedure, you will come to know the details of creating an Outlook meeting in 2007, 2010, 2013 & 2016.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
Suggested Courses

765 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