Solved

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

Posted on 2004-04-05
4
245 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 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

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

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

Find out what you should include to make the best professional email signature for your organization.
This article will help to fix the below errors for MS Exchange Server 2013 I. Certificate error "name on the security certificate is invalid or does not match the name of the site" II. Out of Office not working III. Make Internal URLs and Externa…
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…
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…

707 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