ItemAdd

B

BlockNinja

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(olFolderInbox).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.
 
D

Dmitry Streblechenko

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top