Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Outlook Events and EventHandler()
Message
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Title:
Outlook Events and EventHandler()
Miscellaneous
Thread ID:
00721767
Message ID:
00721767
Views:
70
I have toyed around with eventhandler() to be able to trap events from Outlook. I was able to pop up a message box when a new email arrived in my inbox (okay, no big deal but it's a start). Is there a way to do this kind of event handling at a lower level than the Outlook Application object ... say on an Items object or Item object?

I've tried something like the following:
oObj = CREATEOBJECT("Outlook.Application")
oEvents = NEWOBJECT("myclass","c:\foxtemp\outlook.prg")
oIEvents = NEWOBJECT("myItems","c:\foxtemp\outlook.prg")
oItems = oObj.Session.GetDefaultFolder(6).Items

EVENTHANDLER(oObj, oEvents)
EVENTHANDLER(oItems, oIEvents)

oName = oObj.GetNamespace("MAPI")
oFolder = oName.GetDefaultFolder(6)

oFolder.Display()

RETURN
(The myclass & myitems classes are defined of course)

However, in this case, the binding of the events to oObj works ... the methods I've added code to respond. But the binding with oItems doesn't seem to be working. In the myItems class, I defined the ItemAdd procedure as follows:
   PROCEDURE ItemsEvents_ItemAdd(Item AS VARIANT) AS VOID
   * add user code here
   = MESSAGEBOX("Adding an Item")
   ENDPROC
It seems that if I move an email into the Inbox, the ItemAdd method should trigger and display my messagebox, but that isn't happening.

Any ideas?

Thanks in advance for you help!
Next
Reply
Map
View

Click here to load this message in the networking platform