Enumerate Exchange Emails in vb.Net

Posted on 2007-10-03
Last Modified: 2012-06-27
I have Exchange Server 2007 on my AD which handles all internal messaging. I want to be able to connect to a specific mailbox with a vb.Net app and enumerate all of the messages in the mailbox. It would be nice to be able to read the html in the message, the headers, and any attachments as well. Thanks.
Question by:rbichon
    LVL 8

    Expert Comment

    I'm not 100% sure but I think there are laws prohibiting that functionality
    LVL 1

    Author Comment

    I don't know what you mean by "laws". What I want to do would still require authentication. It would basically act as an email client but would allow me to search for specific headers for advanced processing. I am not trying to hack into my own server.
    LVL 12

    Accepted Solution

    LVL 1

    Author Comment

    I have looked through it and was only able to get the vbscript example to work that displays the size of the folders in a users mailbox. It seems that most of the other examples use ADO or CDO and I haven't found any help there. Any suggestions?
    LVL 1

    Author Comment

    I got most of it working through WebDEV. The only problem I am having is that I cannot get it to download my attachments. Here is the code I am using:

            Dim HttpWebRequest As MSXML2.XMLHTTP60
            Dim GetData As String
            HttpWebRequest = New MSXML2.XMLHTTP60
            With HttpWebRequest
                .open("GET", "", False, UserName, PWD)
            End With
            GetData = HttpWebRequest.responseText

    This should give me the raw data of the file. Does anyone know a better way of doing this?
    LVL 1

    Author Comment

    Finally got it. The code is too long and proprietary to post but I got most of it done with System.Xml.XmlDataDocument and GetElementsByTagName. Downloading attachments has to be done with System.Net.HttpWebRequest.

    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

    Suggested Solutions

    Get an idea of what you should include in an email disclaimer with these Top 5 email disclaimer tips.
    Easy CSR creation in Exchange 2007,2010 and 2013
    In this video we show how to create a Resource Mailbox in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: Navigate to the Recipients >> Resources tab.: "Recipients" is our default selection …
    This video discusses moving either the default database or any database to a new volume.

    754 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