Share via


Adding an Entry to the Audit Trail

Adding an Entry to the Audit Trail

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

You can use the audit trail for logging custom messages during script execution. This can be useful as a debugging tool. Use the AddAuditEntry Method of the IWorkflowSession Interface to log messages to the current audit trail provider.

The following code builds a debug string that is entered in the log when the script runs.

VBScript

Sub SendAuditedMail (MySubject)
   Dim strDebug
   strDebug = vbCrLf
   set WFMsg = WorkflowSession.GetNewWorkflowMessage()
   with WFMsg
      .From = WorkflowSession.Sender
      .To = "someone@example.com"
      .Subject = MySubject
      .TextBody = WorkflowSession.StateFrom & " -> " & WorkflowSession.StateTo
      .SendWorkflowMessage 0 'cdowfNoTracking
      strDebug = strDebug & _
                 "From: " & .from & "; " & _
                 "To: " & .to & "; " & _
                 "Subject: " & .subject & "; " & _
                 "TextBody: " & .textbody & "."
   end with
   WorkflowSession.AddAuditEntry strDebug
End Sub


Send us your feedback about the Microsoft Exchange Server 2003 SDK.

Build: June 2007 (2007.618.1)

© 2003-2006 Microsoft Corporation. All rights reserved. Terms of use.