Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Outlook events
Message
De
25/08/2003 11:58:31
Norbert Kustra
SunSoft plus spol. s r.o.
Dolny Kubin, Slovaquie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Titre:
Divers
Thread ID:
00819377
Message ID:
00823085
Vues:
18
Hi Andrew,
thank you for your detailed answer - yes, in this case it works. But my problem is that I want use not only ApplicationEvents from Outlook which contains few events, but I need catch events from ItemsEvents interface (for example ItemChange event).
Here is my code, but it don't work:

#DEFINE olFolderTasks 13

* instance outlook and get handle to the task folder's items collection object.
loOutlook = CREATEOBJECT("Outlook.Application")
loNameSpace = loOutlook.GetNamespace("MAPI")
loTask= loNameSpace.GetDefaultFolder(13)
loItem = loTask.Items

* instance event handler.
loEvents = CREATEOBJECT("myclass")

* bind event handler to outlook items events.
? EVENTHANDLER(loItem,loEvents)

* add escape hatch: press F12 to stop read events.
ON KEY LABEL f12 CLEAR EVENTS

* see you later - asleep and processing events until F12 is pressed
READ EVENTS

* unbind eventhandler.
? EVENTHANDLER( loItem, loEvents, .T. )

* remove objects.
RELEASE loItem, loTask, loNameSpace,loOutlook

** class definitions **

DEFINE CLASS myclass AS SESSION OLEPUBLIC

IMPLEMENTS ItemsEvents IN "Outlook.Application"

PROCEDURE ItemsEvents_ItemAdd(ITEM AS VARIANT) AS VOID
* add user code here
DEBUGOUT PROGRAM()
DEBUGOUT ITEM.subject
ENDPROC

PROCEDURE ItemsEvents_ItemChange(ITEM AS VARIANT) AS VOID
* add user code here
DEBUGOUT PROGRAM()
DEBUGOUT ITEM.body
ENDPROC

PROCEDURE ItemsEvents_ItemRemove() AS VOID
* add user code here
DEBUGOUT PROGRAM()
ENDPROC

ENDDEFINE

I would be grateful for your trying my code.

Thanks in advance
Norbert

PS: Sorry for my English...
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform