Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7602201
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T23:21:07+00:00 2026-05-30T23:21:07+00:00

Working on application that reads emails. Is there a way besides webdav to get

  • 0

Working on application that reads emails.
Is there a way besides webdav to get all emails from exchange server 2003 to my local machine.
The problem with webdav is that it does not get’s the body of Undelivered emails.

CredentialCache creds = new CredentialCache();
            creds.Add(new Uri(a), "NTLM",
                new NetworkCredential("xxxxx", "xxxxxx", "xxxxx.com"));

            List<Mail> unreadMail = new List<Mail>();
            string reqStr =

            @"<?xml version=""1.0""?>
                <g:searchrequest xmlns:g=""DAV:"">
                    <g:sql>
                        SELECT
                            ""urn:schemas:mailheader:from"",
                            ""urn:schemas:mailheader:to"",
                            ""urn:schemas:httpmail:textdescription""

                        FROM
                            ""http://xxxx.com/exchange/xxxx/Inbox/""
                        WHERE  

                             ""urn:schemas:httpmail:subject"" = 'Undeliverable: xxxx'                               

                        </g:sql>
                </g:searchrequest>";



            byte[] reqBytes = Encoding.UTF8.GetBytes(reqStr);


            HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(a);
            request.Credentials = creds;
            request.Method = "SEARCH";
            request.ContentLength = reqBytes.Length;
            request.ContentType = "text/xml";
            request.Timeout = 300000;
            using (Stream requestStream = request.GetRequestStream())
            {
                try
                {
                    requestStream.Write(reqBytes, 0, reqBytes.Length);
                }
                catch
                {
                }
                finally
                {
                    requestStream.Close();
                }
            }
            HttpWebResponse response = (HttpWebResponse)request.GetResponse();
            using (Stream responseStream = response.GetResponseStream())
            {
                try
                {
                    XmlDocument document = new XmlDocument();
                    document.Load(responseStream);


                    XmlNamespaceManager nsmgr = new XmlNamespaceManager(document.NameTable);
                    nsmgr.AddNamespace("a", "DAV:");
                    nsmgr.AddNamespace("b", "urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/");
                    nsmgr.AddNamespace("c", "xml:");
                    nsmgr.AddNamespace("d", "urn:schemas:mailheader:");
                    nsmgr.AddNamespace("e", "urn:schemas:httpmail:");


                    XmlNodeList responseNodes = document.GetElementsByTagName("a:response");
                    foreach (XmlNode responseNode in responseNodes)
                    {

                        XmlNode uriNode = responseNode.SelectSingleNode("child::a:href", nsmgr);
                        XmlNode propstatNode = responseNode.SelectSingleNode("descendant::a:propstat[a:status='HTTP/1.1 200 OK']", nsmgr);
                        if (propstatNode != null)
                        {
                            // read properties of this response, and load into a data object
                            XmlNode fromNode = propstatNode.SelectSingleNode("descendant::d:from", nsmgr);
                            XmlNode descNode = propstatNode.SelectSingleNode("descendant::e:textdescription", nsmgr);
                            XmlNode toNode = propstatNode.SelectSingleNode("descendant::d:to", nsmgr);


                            // make new data object

                            Mail mail = new Mail();
                            if (uriNode != null)
                                mail.Uri = uriNode.InnerText;
                            if (fromNode != null)
                                mail.From = fromNode.InnerText;
                            if (descNode != null)
                                mail.Body = descNode.InnerText;
                            if (toNode != null)
                                mail.To = toNode.InnerText;
                            unreadMail.Add(mail);

                        }
                    }
                    var ac = unreadMail;

                }
                catch (Exception e)
                {
                    string msg = e.Message;
                }
                finally
                {

                    responseStream.Close();
                }
            }

in the output xml i get empty text description for undelivered emails:

<a:status>HTTP/1.1 404 Resource Not Found</a:status><a:prop><e:textdescription /></a:prop></a:propstat></a:response>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T23:21:09+00:00Added an answer on May 30, 2026 at 11:21 pm

    I see several options to communicate with Exchange servers – WebDAV is rather hard to use and is not well supported in later version (2010), MS provides EWS but these don’t work with older versions.

    From my POV you can use any of the following components (commercial!):

    • http://www.independentsoft.de/webdavex/index.html (WebDAV-based)
    • http://www.dimastr.com/redemption/home.htm (COM- / Extended MAPI-based)
    • http://www.afterlogic.com/mailbee-net/imap-component (IMAP4-based)

    Another point:

    When handling Undeliverable mails I made the experience that the body is sometimes provided as an attachment – in WebDAV this needs to be accessed via the X-MS-ENUMATT verb (but BEWARE: specific “attachments” like winmail.dat are automagically “decoded” by Outlook on display).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on ASP application that reads data from sql server and displays
I am working on an application that reads media from the sd-card and plays
I'm working on an application that reads and writes binary data from and to
I'm working on an application that accepts TCP connections and reads in data until
All, I'm working on an application that allows authorized users to upload Excel spreadsheets
I am working on a program that reads in from a serial port, then
I have an small ASP.NET application that reads data from a table and sends
I'm working with SQL Server 2000 and Java. I am creating an application that,
I have an application that reads/writes from/to message queues on remote application servers. The
I'm working on an application that has a read-only database shipped with it. The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.