![]() |
ItemAdd
I have been looking over the Internet for a solution in Outlook 2000 that
will let me show a popup window whenever a new email comes in. In the ThisOutlookSession all I see is an event for Application_NewMail(), but I have seen Microsoft MVP's on some sites saying that you should use the ItemAdd event, however I do not see this in Outlook 2000. Did it not come around until Office XP? This is my code right now: Private Sub Application_NewMail() Dim myitem As Object Set myitem = Me.GetNamespace("MAPI").GetDefaultFolder(olFolderI nbox).Items(1) Dim subj, from As String subj = myitem.Subject from = "Receipt" On Error Resume Next from = myitem.SenderName On Error GoTo 0 Shell "c:\mycode\PopupMessage\bin\Debug\PopupMessage .exe """ & from & """ """ & subj & """", vbNormalNoFocus Set myitem = Nothing End Sub It basically just looks at the first item in the Inbox whenever a NewMail hits, I then invoke a small Windows app I made in C# (luckily I have Visual Studio .NET on this computer, just not Office 2003...) that displays the from/subj for 3 seconds in a small window and quits. I used the On Error b/c it looks like if the item is a Read Receipt, it doesn't have a SenderName attached to it. |
ItemAdd
ItemAdd event *is* exposed in Outlook 2000, but it is the event on the Items
collection (MAPIFolder.Items). Do not assume that the newly delivered message will be the first (or last) message in the Inbox. Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "BlockNinja" wrote in message ... I have been looking over the Internet for a solution in Outlook 2000 that will let me show a popup window whenever a new email comes in. In the ThisOutlookSession all I see is an event for Application_NewMail(), but I have seen Microsoft MVP's on some sites saying that you should use the ItemAdd event, however I do not see this in Outlook 2000. Did it not come around until Office XP? This is my code right now: Private Sub Application_NewMail() Dim myitem As Object Set myitem = Me.GetNamespace("MAPI").GetDefaultFolder(olFolderI nbox).Items(1) Dim subj, from As String subj = myitem.Subject from = "Receipt" On Error Resume Next from = myitem.SenderName On Error GoTo 0 Shell "c:\mycode\PopupMessage\bin\Debug\PopupMessage .exe """ & from & """ """ & subj & """", vbNormalNoFocus Set myitem = Nothing End Sub It basically just looks at the first item in the Inbox whenever a NewMail hits, I then invoke a small Windows app I made in C# (luckily I have Visual Studio .NET on this computer, just not Office 2003...) that displays the from/subj for 3 seconds in a small window and quits. I used the On Error b/c it looks like if the item is a Read Receipt, it doesn't have a SenderName attached to it. |
All times are GMT +1. The time now is 08:16 PM. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com