AddEntry Method
AddEntry Method
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.
Add entry to audit trail.
Applies To
Type Library
Microsoft CDO Workflow Objects for Microsoft Exchange
DLL Implemented In
CDOWF.DLL
Syntax
[Visual Basic]Sub AddEntry
(
bsDescription As String,
hResult As Long,
eEvent As CdoWfAuditTrailEvents,
[varStateChangeInfo As Variant],
[varUserSid As Variant]
)
[C++]HRESULT AddEntry ( BSTR bsDescription, long hResult, CdoWfAuditTrailEvents eEvent, VARIANT varStateChangeInfo, VARIANT varUserSid );
Parameters
- bsDescription
A string containing a textual description of the audit trail entry. This can be an empty string.- hResult
The result of operation being logged. Negative hResult indicates an error.- eEvent
Specifies the type of audit trail entry.- varStateChangeInfo
Can be either empty or an array of strings that describe the state change information. In C++ it can be either an empty VARIANT or a VARIANT containing a SAFEARRAY of 5 BSTR. In Microsoft Visual Basic it can either be omitted or contain an array of 5 Strings. The five strings represent, in order: New State, Old State, Caption, Event Type, ID.- varUserSid
(optional) Contains a security identifier (SID). The VARIANT type is either VT_EMPTY or VT_ARRAY | VT_UI1. The value is a SAFEARRAY of bytes corresponding to the SID.
Return Value
Returns S_OK if successful, or an error value otherwise.
Remarks
You use the AddEntry method to log event information to the configured AuditTrailProvider, which can be the AuditTrailEventLog provider supplied with workflow for Microsoft Exchange Server 2003, or one you wrote yourself.
The workflow engine calls AddEntry for every state transition. The information written to the AuditTrailProvider specifies whether a state transition was successful. Success entries are added only if they are enabled. You can enable success entries by:
- Setting https://schemas.microsoft.com/cdo/workflow/enablesuccessentries = True in the event sink registration item.
- Selecting a check box in Workflow Designer for Exchange 2000 Server.
AddEntry can also be called from script using the AddAuditEntry Method of the IWorkflowSession Interface. The workflow engine assigns cdowfATECustom to eEvent for entries made by script.
Example
The following example illustrates the use of the IWorkflowSession AddAuditEntry method, which uses the IAuditTrail AddEntry method. The example code writes to the audit trail affirmative messages that help the developer to trace the progress of the code. This is useful in debugging a workflowapplication. Using the AddAuditEntry method is the preferred way to log messages for most typical application developers. Normally, you won't use the AddEntry method directly, unless you are implementing your own audit trail provider.
[Visual Basic]
Sub AddProp()
WorkflowSession.TrackingTable.MoveFirst
For i = 0 To WorkflowSession.TrackingTable.RecordCount - 1 Step 1
If WorkflowSession.Sender = WorkflowSession.TrackingTable.fields("email").Value Then WorkflowSession.AddAuditEntry "email address matched"
If "A" = WorkflowSession.TrackingTable.fields("state").Value Then
'the state value here is hard coded you will have to
'change this for your own action table
WorkflowSession.AddAuditEntry "state matched"
WorkflowSession.TrackingTable.fields.Item("custom0").Value = WorkflowSession.ReceivedMessage.fields("Amount").Value
WorkflowSession.AddAuditEntry "added the value to the customfield"
WorkflowSession.TrackingTable.Update
End If
End If WorkflowSession.TrackingTable.MoveNext Next WorkflowSession.DeleteReceivedMessage
End Sub
See Also
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.