|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Events not treated :(We are currently developping an application to synchronize data between a Public Folder (Exchange 2003, Contacts) and a database. By using "regevent.vbs" or "Exchange Explorer" we can configure to treat an event (OnSave) by a simple vbscript. For our tests, this script is adding a line in text log file. But... never the event is treated, never the script is executed. The event service is running. We checked the public folder with the Exchange Explorer - the scripts/events are registered. Has everybody any idea about this problem ? Thanks a lot ! Dominique The script : ---------------------------------------------------------------------- Sub IExStoreAsyncEvents_OnSave(ptrEventInfo, bstrURLItem, lngFlags) ' Dim WshShell ' set WshShell = WScript.CreateObject("WScript.Shell") ' WshShell.LogEvent 4, "Exchange - Event aSync OnSave" Dim fso Dim vFile Set fso = CreateObject("Scripting.FileSystemObject") vLogFile = "E:\Program Files\Exchsrvr\Tools\LOG\Test.log" Set vFile = fso.CreateTextFile(vLogFile , True) vFile.WriteLine("event OnSave") vFile.close set fso = nothing End Sub ---------------------------------------------------------------------- Command used : cscript "E:\Program Files\Exchsrvr\Tools\RegEvent.vbs" Add "OnSave" ExOleDB.ScriptEventSink.1 "file://./backofficestorage/LOCAL.KIPLING.CH/PUBLIC FOLDERS/Kipling/gbo contacts" -file "E:\Program Files\Exchsrvr\Tools\LogTest.vbs" Your sub declaration is wrong for a VBS event sink it should be something
like (sub decs for VB and VBS are different) Sub ExStoreEvents_OnSave(pEventInfo, bstrURLItem, lFlags) have a look at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/e2k3/e2k3/_exch2k_event_naming_script.asp Also you need to make sure your script is wrapped in <SCRIPT LANGUAGE="VBScript"></SCRIPT> tags You also need to make sure the Exoledb script host is registered properly http://support.microsoft.com/default.aspx?scid=kb;EN-AU;q264995 and is running under an account that has access to the public folder you are trying to register the sink on (don't get fooled by admin accounts make sure you check the mapi permissions on the folder to ensure that this user has rights) One other thing to watch out for here is that some antivirus programs quarantine the script code so you end up with a registered event with nothing inside it. You can try the following code snipit to check what's inside your event registration (which if you have used the -file switch will be your script code). set msgobj = createobject("CDO.Message") msgobj.datasource.open "file://./backofficestorage/mydomain.com/mbx/TestAccount/inbox/yoursink" set stm = CreateObject("ADODB.Stream") Set stm = msgobj.GetStream stm.savetofile "c:\dumpmsg.txt" Cheers Glen Show quote "D.Hinnen" <d*@gbo.ch.nospam> wrote in message news:e4oyqTAQFHA.688@TK2MSFTNGP14.phx.gbl... > Hi guys ! > > We are currently developping an application to synchronize data between a > Public Folder (Exchange 2003, Contacts) and a database. > > By using "regevent.vbs" or "Exchange Explorer" we can configure to treat > an event (OnSave) by a simple vbscript. > For our tests, this script is adding a line in text log file. > > But... never the event is treated, never the script is executed. > The event service is running. We checked the public folder with the > Exchange Explorer - the scripts/events are registered. > > Has everybody any idea about this problem ? > > Thanks a lot ! > > Dominique > > > The script : > ---------------------------------------------------------------------- > Sub IExStoreAsyncEvents_OnSave(ptrEventInfo, bstrURLItem, lngFlags) > ' Dim WshShell > ' set WshShell = WScript.CreateObject("WScript.Shell") > ' WshShell.LogEvent 4, "Exchange - Event aSync OnSave" > Dim fso > Dim vFile > Set fso = CreateObject("Scripting.FileSystemObject") > vLogFile = "E:\Program Files\Exchsrvr\Tools\LOG\Test.log" > Set vFile = fso.CreateTextFile(vLogFile , True) > vFile.WriteLine("event OnSave") > vFile.close > set fso = nothing > End Sub > ---------------------------------------------------------------------- > > Command used : > cscript "E:\Program Files\Exchsrvr\Tools\RegEvent.vbs" Add "OnSave" > ExOleDB.ScriptEventSink.1 > "file://./backofficestorage/LOCAL.KIPLING.CH/PUBLIC FOLDERS/Kipling/gbo > contacts" -file "E:\Program Files\Exchsrvr\Tools\LogTest.vbs" |
|||||||||||||||||||||||