Re: Detect Undeliverable Email using WebDAV?



Generally MAPI isn't supported in .NET (but the Outlook Object Model which
uses Mapi is) so if you want to use MAPI from .NET create a COM object in
C++ with your extended MAPI code and then just invoke the different
functions you want from your managed code. There's at least one third party
wrapper for Extended Mapi that i know of called Mapi33.

On Second look the Text itself is in the message stream stored in seperate
bodyparts (which X-MS-ENUMATTS doesn't enumerate) so if you get the message
Stream with WebDAV using a Get you can then parse the content back out of
the responsestream. eg this is a quick sample using CDOEX/CDOSYS as the
parser.

href = "http://server/exchange/mailbox/Inbox/Undeliverable:blah.EML";
set req = createobject("microsoft.xmlhttp")
req.open "GET", href, false
req.setRequestHeader "Translate","f"
req.send
set stm = createobject("ADODB.Stream")
stm.open
msgstring = req.responsetext
rem wscript.echo msgstring
stm.type = 2
stm.Charset = "x-ansi"
stm.writetext msgstring,0
stm.Position = 0
stm.type = 1
set msgobj = createobject("CDO.Message")
msgobj.datasource.openobject stm,"_Stream"
wscript.echo msgobj.fields("urn:schemas:httpmail:textdescription")
set objbparts = msgobj.bodypart.bodyparts
for each objbpart in objbparts
if objbpart.ContentMediaType = "message/delivery-status" then
wscript.echo objbpart.getstream.readtext
end if
next

Cheers
Glen


"Li Weng" <wlwlwlwl@xxxxxxxxxxxxxxxx> wrote in message
news:B1B41D49-B157-4033-BED0-7B3A85741ECF@xxxxxxxxxxxxxxxx
I may not make my question clear.
What I meant is that MAPI is NOT supported by Microsoft for Exchange APIs
with .NET Framework Applications from Article 813349. It also stated "If
the
.NET application assemblies do not reside directly on the Exchange Server,
Microsoft recommends using WebDAV."

That's why we implemented WebDAV in our application. Now we have this
problem that Undeliverable emails can't be retrieved via WebDAV.

Thanks.

Li

"Li Weng" wrote:

Hi, Glen:

To my knowledge, MAPI can only be used within the Exchange server. right?
Generally speaking, if an application in another server wants to retrieve
all emails of an account in an Exchange server, how can it retrieve
Undeliverable emails?

Thanks.
Li

"Glen Scales [MVP]" wrote:

This information is stored in the Recipients table of the message in
the
PR_NDR_STATUS_CODE , PR_REPORT_TEXT fields (if you have a look at a NDR
in
Outlook Spy or Mdbvu32 you can see these fields). I don't believe there
is
anyway to access the Recipients table via WebDAV the only way is to use
MAPI.

Cheers
Glen

"Li Weng" <wlwlwlwl@xxxxxxxxxxxxxxxx> wrote in message
news:FCE825A0-87F9-480B-873F-91BD5E7921DE@xxxxxxxxxxxxxxxx
Hi, Glen:

I can get my original email (yes, it's as an attachment). The problem
is I
want to get the system's message, i.e.,

"Your message did not reach some or all of the intended recipients.
..."

In order word, I want to get nondelivery report contents, especially
which
email addresses are undeliverable, using WebDAV.

Thanks.

Li

"Glen Scales [MVP]" wrote:

The original message (if it is there) is stored as a separate body
part
on
the message. Depending on what API your using in CDOEX you can get
this
by
just looping though the attachments collection and looking for a
message
with a content type of RFC/822 eg

set msgobj = createobject("CDO.Message")
msgobj.datasource.open Href,oCon,3
set objattachments = msgobj.attachments
for each objattachment in objattachments
if objAttachment.ContentMediaType = "message/rfc822" then
set msgobj1 = createobject("cdo.message")
msgobj1.datasource.OpenObject objattachment, "ibodypart"
exit for
end if
next

In WebDAV you should be able to do something simular with the
X-MS-ENUMATTS
Method or just get the whole message stream and parse it out
yourself.

Cheers
Glen

"Li Weng" <wlwlwlwl@xxxxxxxxxxxxxxxx> wrote in message
news:67771CC2-3969-44C1-A839-BF4E872467D8@xxxxxxxxxxxxxxxx
Hi,

I saw the discussion about "Detect Undeliverable Email using
WebDAV" by
Frank and Glen. I had the similar problem and I also want to get
the
Undeliverable email body, i.e.,

"Your message did not reach some or all of the intended
recipients.
Subject: 11:46. 1/26/06.
Sent: 1/26/2006 11:47 AM
The following recipient(s) could not be reached: ... "

What property holds it? htmldescription and textdescription
properties
don't
exist for Undeliverable email from Exchange. In other word, how to
get
this
Nondelivery report contents?

Thanks in advance.

Li









.



Relevant Pages

  • Re: WebDAV vs. MAPI performance
    ... Are you using WebDAV batch operations? ... Are you using the XML DOM or the XML Reader/SAX ... MAPI requires IAdviseSink required live connection to every mailbox. ... I did some additional load testing on a 2 proc Exchange server. ...
    (microsoft.public.exchange.applications)
  • WEBDAV or MAPI
    ... I am in the process of evaluating which is the best technology to talk ... To my understanding MAPI is the most native way to talk to exchange ... server and WebDAV interacts with Exchange server via http calls. ...
    (microsoft.public.win32.programmer.messaging)
  • Re: WebDAV vs. MAPI performance
    ... Which development language will you use. ... MAPI is not supported by Microsoft. ... WebDAV simply suffers from some overhead ... exchange server. ...
    (microsoft.public.exchange.applications)
  • Re: WebDAV vs. MAPI performance
    ... I did some additional load testing on a 2 proc Exchange server. ... harvest regardless of the number of webdav connections we employ. ... MAPI is not supported by Microsoft. ...
    (microsoft.public.exchange.applications)
  • RE: WEBDAV or MAPI
    ... even though the MAPI path is tougher and more time ... or CDOEX which only can be implemented on the Exchange server ... > I am in the process of evaluating which is the best technology to talk ... > WebDAV. ...
    (microsoft.public.win32.programmer.messaging)

Loading