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.
I'm not 100% sure but I think there are laws prohibiting that functionality
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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?
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.responseTex t
MsgBox(GetData)
This should give me the raw data of the file. Does anyone know a better way of doing this?
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.responseTex
MsgBox(GetData)
This should give me the raw data of the file. Does anyone know a better way of doing this?
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.