Link to home
Start Free TrialLog in
Avatar of rbichon
rbichon

asked on

Enumerate Exchange Emails in vb.Net

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.
Avatar of bramsquad
bramsquad
Flag of United States of America image

I'm not 100% sure but I think there are laws prohibiting that functionality
Avatar of rbichon
rbichon

ASKER

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.
ASKER CERTIFIED SOLUTION
Avatar of craskin
craskin
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rbichon

ASKER

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?
Avatar of rbichon

ASKER

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", "https://myserver.com/exchange/username/inbox/test.eml/attachment.pdf", False, UserName, PWD)
            .send()
        End With
        GetData = HttpWebRequest.responseText
        MsgBox(GetData)

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

ASKER

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.