M
mlafarlett
I've seen this post numerous times but can't seem to derive the
resolution...I've written a very small test app (vb.net code below) to
demonstrate. My end goal is to have an app to continually monitor the
inbox for new entries and process them according to subject , however,
the event never fires. Thanks in advance, Michael
Imports Outlook = Microsoft.Office.Interop.Outlook
Module subMain
Dim WithEvents oRcvdItems As Outlook.Items
Sub main()
Dim oOL As Outlook.Application
Dim oNS As Outlook.NameSpace
oOL = CreateObject("Outlook.Application")
oNS = oOL.GetNamespace("MAPI")
oRcvdItems =
oNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox).Items
'Sleep forever so we can wait on stuff to show up ( IS THERE A BETTER
WAY TO DO 'THIS?)
SleepForAwhile:
System.Threading.Thread.Sleep(15000)
GoTo SleepForAwhile
oOL = Nothing
oNS = Nothing
oRcvdItems = Nothing
End Sub
Private Sub oRcvdItems_ItemAdd(ByVal Item As Object)
Debug.WriteLine(Item.subject)
End Sub
End Module
resolution...I've written a very small test app (vb.net code below) to
demonstrate. My end goal is to have an app to continually monitor the
inbox for new entries and process them according to subject , however,
the event never fires. Thanks in advance, Michael
Imports Outlook = Microsoft.Office.Interop.Outlook
Module subMain
Dim WithEvents oRcvdItems As Outlook.Items
Sub main()
Dim oOL As Outlook.Application
Dim oNS As Outlook.NameSpace
oOL = CreateObject("Outlook.Application")
oNS = oOL.GetNamespace("MAPI")
oRcvdItems =
oNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox).Items
'Sleep forever so we can wait on stuff to show up ( IS THERE A BETTER
WAY TO DO 'THIS?)
SleepForAwhile:
System.Threading.Thread.Sleep(15000)
GoTo SleepForAwhile
oOL = Nothing
oNS = Nothing
oRcvdItems = Nothing
End Sub
Private Sub oRcvdItems_ItemAdd(ByVal Item As Object)
Debug.WriteLine(Item.subject)
End Sub
End Module