Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Reading the Body of an Undeliverable e-mail

160 views
Skip to first unread message

Jason Kemp

unread,
Feb 8, 2002, 4:04:52 PM2/8/02
to
I would appreciate any help that anyone can offer. I am trying to write a VB
program that will loop through all of the undeliverable e-mails in a folder
that we have set up on our exchange server. I need to grab the body or the
"to" e-mail address to flag the address as "bad" in our database. I have
been able to grab the body of the mail if the e-mail is a MailItem, but for
undeliverable items, the object is a ReportItem. There is a property for
the body but it always returns an empty string. My code so far is as
follows:

Dim objOutlookApp As Outlook.Application
Dim objMapiFldr As Outlook.MAPIFolder

Dim objReportItem As Outlook.ReportItem
Dim intCounter As Integer, strProperty As String

Set objOutlookApp = New Outlook.Application
Set objMapiFldr =
objOutlookApp.GetNamespace("MAPI").Session.Folders("Mailbox").Folders("Inbox
")

For intCounter = 1 To objMapiFldr.Items.Count
Set objReportItem = objMapiFldr.Items.Item(intCounter)
strProperty = objReportItem.Body
MsgBox strProperty

Next

Set objMapiFldr = Nothing
Set objReportItem = Nothing

I'm not sure why the Body property is available if it cannot be accessed.
Any help would be appreciated.

Thank you,

Jason Kemp
jk...@thedebtsolution.com


Sue Mosher [MVP]

unread,
Feb 8, 2002, 5:03:05 PM2/8/02
to
A ReportItem never has anything in the Body property. The "body" that the user sees in the UI is built on-the-fly from undocumented MAPI properties on the item. A tool like Mdbvu32.exe or Outlook Spy (http://www.dimastr.com) will show you which ones might be useful. See http://www.cdolive.com/cdo10.htm for a primer on working with MAPI properties via CDO property tags.

--
Sue Mosher, Outlook MVP
Outlook and Exchange Solutions
at http://www.slipstick.com


"Jason Kemp" <jk...@thedebtsolution.com> wrote in message news:O6CAHPOsBHA.2452@tkmsftngp03...

0 new messages