Solved

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

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
If you don't know how to downgrade, my instructions below should be helpful.
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

706 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now