I'm trying to write an Exchange Agent script in VBscript that will
process NDR items in an Exchange mailbox. The goal of the script is
to determine the reason for the NDR, and process only those NDRs that
are due to permanent failures (such as "user unknown", "account
disabled", etc.) as opposed to transient errors (such as
"communications failure", "mailbox full", etc.)
The script has no problems with NDRs that of type "IPM.Note" such as
those returned by a SendMail server - it simply parses the
Message.Text property for certain strings. If the NDR comes from an
Exchange server however it is usually of type "Report.IPM.Note.NDR"...
and here where the problem lies:
Under Outlook 2000 the ".Body" property of a Note.NDR is empty
(apparently Outlook 2002 corrects this though). The text you see when
viewing the NDR in Outlook is actually built up from various other
extended MAPI properties, namely "PR_REPORT_TEXT", "PR_NDR_DIAG_CODE"
and "PR_NDR_REASON_CODE". According to MDBVU32 these all appear to be
properties of the first recipient in the recipient table of the NDR
item. My question is: how can I read these properties using CDO?
I'm a CDO novice but have even less MAPI experience. I've browsed all
of the Usenet groups I can get my hands on and it seems that these is
very little out there about Note.NDR messages as they are practically
undocumented. One post I saw said that because these properties are
part of the recipient table there is no way to get at them using CDO -
you must use Extended MAPI calls. My script is written in pure
VBScript using CDO, so I'm trying to find some way of doing this
without switching to C++ / Extended MAPI.
These is a post by Sue Mosher
(http://groups.google.com/groups?hl=en&threadm=ejMcYpAMBHA.1936%40tkmsftngp05&rnum=40&prev=/groups%3Fq%3D.ndr%2Bcdo%26hl%3Den%26start%3D30%26sa%3DN)
which mentions getting at them using CDO. Hopefully Sue is reading
this and could share her experiences with us? Surely there's a way of
doing this without resorting to C++?
Thanks for you time!
Regards,
Jacob Luebbers
set sItem = CreateObject("Redemption.SafeMailItem")
sItem.Item = ReportItem
MsgBox sItem.Recipients.Item(1).Fields(&H1001001E)
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
"Jacob" <jac...@globalknowledgeconsultants.com> wrote in message
news:2369d983.02030...@posting.google.com...
Regards,
Jacob
"Dmitry Streblechenko" <dmi...@dimastr.com> wrote in message news:<OPrptrGxBHA.2208@tkmsftngp05>...
> You might want to try Redemption (url in my sig.) - it's Recipient object (e.g.
> SafeMailItem.Recipients.Item(1)) has Fields collection you can use to access
> properties from the recipient table.
> Assuming ReportItem is the Outlook OM NDR:
>
> set sItem = CreateObject("Redemption.SafeMailItem")
> sItem.Item = ReportItem
> MsgBox sItem.Recipients.Item(1).Fields(&H1001001E)
>
> Dmitry Streblechenko (MVP)
> http://www.dimastr.com/
> OutlookSpy - Outlook, CDO
> and MAPI Developer Tool
>
> > Regards,
> >
> > Jacob Luebbers
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
"Jacob" <jac...@globalknowledgeconsultants.com> wrote in message
news:2369d983.02030...@posting.google.com...
Regards,
Jacob
"Dmitry Streblechenko" <dmi...@dimastr.com> wrote in message news:<uqKjgGTxBHA.1400@tkmsftngp07>...