SuperGeek2006
Programmer
Hello,
I need to write an applcation that reads mail from a microsoft exchange server using VB.NET. I have heard that using MSMAPI is the way to go. However, it seems like all the code samples I can find are for using MAPI to send mail. Does anyone have a code sample of how to read mail? I have tried fumbling with MAPI with the code below and on the CreateObject line I get and error like cannot create active x control. Does anyone know why this might be? Does anyone know where I can find a code sample that works? Any recommended books? Any advice would be greatly appreciated.
Imports System.Web
Imports MSMAPI
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim session As New MSMAPI.MAPISession
Dim m As New MSMAPI.MAPIMessages
session = CreateObject("MAPI.Session", "exchange.mailserver.com")
session.UserName = "developertest"
session.Password = "developer"
Try
session.SignOn()
Catch ex As Exception
MessageBox.Show("not signed it")
End Try
MessageBox.Show("Done")
session.SignOff()
'session.DownLoadMail()
'm.Fetch()
End Sub
End Class
I need to write an applcation that reads mail from a microsoft exchange server using VB.NET. I have heard that using MSMAPI is the way to go. However, it seems like all the code samples I can find are for using MAPI to send mail. Does anyone have a code sample of how to read mail? I have tried fumbling with MAPI with the code below and on the CreateObject line I get and error like cannot create active x control. Does anyone know why this might be? Does anyone know where I can find a code sample that works? Any recommended books? Any advice would be greatly appreciated.
Imports System.Web
Imports MSMAPI
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim session As New MSMAPI.MAPISession
Dim m As New MSMAPI.MAPIMessages
session = CreateObject("MAPI.Session", "exchange.mailserver.com")
session.UserName = "developertest"
session.Password = "developer"
Try
session.SignOn()
Catch ex As Exception
MessageBox.Show("not signed it")
End Try
MessageBox.Show("Done")
session.SignOff()
'session.DownLoadMail()
'm.Fetch()
End Sub
End Class