J
josephine
managed to filter Inbox Folder to get only relevant mails.
now i need to get e-mail's body
?question:
how do i get a MailItem into oM representd by a row in oTable???
Imports system
Imports System.IO
Imports System.Windows.Forms
Imports System.Xml
Imports outlook = Microsoft.Office.Interop.Outlook
Public Class frmMain
Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim objOutlook As Microsoft.Office.Interop.Outlook.Application
Dim oM As Microsoft.Office.Interop.Outlook.MailItem
objOutlook = New Microsoft.Office.Interop.Outlook.Application
Dim oNS As Microsoft.Office.Interop.Outlook.NameSpace
oNS = objOutlook.GetNamespace("mapi")
Dim oFolder As Microsoft.Office.Interop.Outlook.MAPIFolder
oFolder =
oNS.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderInbox)
Dim filter As String = "[subject]=SCMB Securities Lending extract
AND [unread]=true "
Dim oTable As Microsoft.Office.Interop.Outlook.Table
Try
oTable =
oNS.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderInbox).GetTable(filter)
Catch ex As Exception
MsgBox(ex.Message)
End Try
MsgBox(oTable.GetRowCount)
Do Until oTable.EndOfTable
oM = oTable.FindNextRow
MsgBox(oM.HTMLBody)
Loop
objOutlook.Quit()
objOutlook = Nothing
GC.Collect()
End Sub
End Class
now i need to get e-mail's body
?question:
how do i get a MailItem into oM representd by a row in oTable???
Imports system
Imports System.IO
Imports System.Windows.Forms
Imports System.Xml
Imports outlook = Microsoft.Office.Interop.Outlook
Public Class frmMain
Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim objOutlook As Microsoft.Office.Interop.Outlook.Application
Dim oM As Microsoft.Office.Interop.Outlook.MailItem
objOutlook = New Microsoft.Office.Interop.Outlook.Application
Dim oNS As Microsoft.Office.Interop.Outlook.NameSpace
oNS = objOutlook.GetNamespace("mapi")
Dim oFolder As Microsoft.Office.Interop.Outlook.MAPIFolder
oFolder =
oNS.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderInbox)
Dim filter As String = "[subject]=SCMB Securities Lending extract
AND [unread]=true "
Dim oTable As Microsoft.Office.Interop.Outlook.Table
Try
oTable =
oNS.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderInbox).GetTable(filter)
Catch ex As Exception
MsgBox(ex.Message)
End Try
MsgBox(oTable.GetRowCount)
Do Until oTable.EndOfTable
oM = oTable.FindNextRow
MsgBox(oM.HTMLBody)
Loop
objOutlook.Quit()
objOutlook = Nothing
GC.Collect()
End Sub
End Class