Platform SDK: Exchange 2000 Server |
[This is preliminary documentation and subject to change.]
Bind audit trail to a process instance.
[Visual Basic,VBScript] Sub Bind(pProcessInstance As ProcessInstance) [C++] HRESULT Bind(IProcessInstance* pProcessInstance); [IDL] HRESULT Bind([in] IProcessInstance* pProcessInstance);
You use this method only if you are not using the CDO Workflow Event Sink but are calling the workflow engine. Otherwise, the workflow engine takes care of binding the AuditTrailProvider to the ProcessInstance.
Bind is called by the event sink before executing Advance() or OnAbort(). After executing Advance() or OnAbort() IAuditTrail.Bind(0) is called. The workflow engine creates an instance of the audit trail class automatically in the following cases:
The workflow engine calls IAuditTrail::Bind(0) in the end of Advance() and OnAbort() to release the IProcessInstance pointer. If the audit trail is used outside the workflow engine, always call IAuditTrail::Bind(0) when the audit trail is not needed any more or goes out of scope. Otherwise neither the ProcessInstance pointer nor the IAuditTrail pointer will be destroyed.
The following function uses the Bind method of IAuditTrail as implemented by the AuditTrailEventLog object. The function is given a reference to a ProcessInstance object. It creates an AuditTrail object by using the ProgID of AuditTrailEventLog. Then it binds the audit trail provider to the ProcessInstance.
Function bATBind(iPI As CDOWF.ProcessInstance) As Boolean On Error Resume Next bATBind = True Dim iAT As Object Set iAT = CreateObject("CDOWF.AuditTrailEventLog") iAT.Bind iPI If Err.Number <> S_OK Then ' Error handling code '... bATBind = False Else iAT.AddEntry "Bind Succeeded." End If iAT.Bind Nothing End Function