how can i get the current user which starts the store eventsink???



Hello,

i have built a script with the EventSink Wizard from the Exchange SDK
Tools.

Now i wanna add the user ,which start the store eventsink, too the
logfile generated by the script. In the code snippet below i added my
coding with * at the begin of the line.

This script below doesn't work with my code but it works without it.

#############################

Sub EventLog(EventName As String, ByVal bstrURLItem As String,
Optional ByVal lFlags As Long = 0, Optional bstrComment As String =
"")


*Dim user As String
*Dim objSession As MAPI.Session
*Set objSession = CreateObject("MAPI.Session")
*objSession.Logon

*user = objSession.CurrentUser

'This function writes to the log file details of an event being
executed. It is called from each event procedure.
If Not PERFORM_FILE_LOGGING Then 'Check if logging is turned off
Exit Sub ' If so, do not perform logging
End If

Dim FSO As Scripting.FileSystemObject
Dim WinTmpFile As String
Dim OnSaveFile As Scripting.TextStream

Set FSO = New Scripting.FileSystemObject
'Instantiate the FileSystemObject
WinTmpFile = FSO.GetSpecialFolder(SystemFolder).Path & "\" &
LogFile 'Set the path of the log file to be in the Windows System
Folder
Set OnSaveFile = FSO.OpenTextFile(WinTmpFile, 8, True)
'Open the file for Appending
OnSaveFile.WriteLine Format(Now, DATE_TIME_FORMAT)
'Write the current date and time
OnSaveFile.WriteLine (" Event Name:" & EventName)
'Write the Event Name
OnSaveFile.WriteLine (" URL of Source Item:" & vbTab &
bstrURLItem) 'Write the URL of the Event source
OnSaveFile.WriteLine (ReturnEXOLEDBFlags(lFlags))
'Write the flags that are currently set
OnSaveFile.WriteLine (" COMMENT:" & vbTab & bstrComment)
'Write the comment, if any
* OnSaveFile.WriteLine (" User:" & user)
'Write the comment, if any
OnSaveFile.WriteLine (String(80, "-"))
'Write a separator line to the file
OnSaveFile.WriteBlankLines (1)
'Insert a blank line into the file
OnSaveFile.Close
'Close the log file
Set FSO = Nothing

End Sub
#####################


can anyone help me.


thanx
florian
.



Relevant Pages

  • Re: Script: Remote shutdown of all domain computers
    ... When trying to run the script from a XP workstation, where i am logged in as ... Dim strBase, strFilter, strAttributes, strQuery, objRecordSet ... 2000 or above and allow shutdown, ... Public Function AllComputersAs String() ...
    (microsoft.public.windows.server.scripting)
  • Re: Displaying text output in one external window
    ... application I use to control a script ... the log file and displays it in a ... > Dim oShell ... > Sub SaveScript() ...
    (microsoft.public.scripting.wsh)
  • Script: Remote shutdown of all domain computers
    ... I'v searched through the newsgroups for a complete script but to no result. ... I'v also found a script to search trough AD for the computers and added the ... Public Function AllComputersAs String() ... 'Dim sArray() As String ...
    (microsoft.public.windows.server.scripting)
  • Re: Script: Remote shutdown of all domain computers
    ... Also with this script: What if the IPadress of the PC changed recently? ... 2000 or above and allow shutdown, ... Dim strBase, strFilter, strAttributes, strQuery, objRecordSet ... Public Function AllComputersAs String() ...
    (microsoft.public.windows.server.scripting)
  • Re: Script: Remote shutdown of all domain computers in spec. OU
    ... I'v searched through the newsgroups for a complete script but to no ... I'v also found a script to search trough AD for the computers and added ... Public Function AllComputersAs String() ... 'Dim sArray() As String ...
    (microsoft.public.scripting.vbscript)

Quantcast