Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Outlook Events and EventHandler()
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Titre:
Outlook Events and EventHandler()
Divers
Thread ID:
00721767
Message ID:
00721767
Vues:
71
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!
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform