Partager via


Bind Method

Bind 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.

Bind audit trail to a process instance.

Applies To

IAuditTrail Interface

Type Library

Microsoft CDO Workflow Objects for Microsoft Exchange

DLL Implemented In

CDOWF.DLL

Syntax

[Visual Basic]Sub Bind
(
    pProcessInstance As ProcessInstance
)

[C++]HRESULT Bind (     IProcessInstancepProcessInstance );

Parameters

Return Value

Returns S_OK if successful, or an error value otherwise.

Remarks

You use this method only if you are not using the Collaboration Data Objects (CDO) workflow event sink but are calling the workflow engine. Otherwise, the workflow engine takes care of binding the AuditTrailProvider to the ProcessInstance.

An instance of the AuditTrailProvider class is created automatically by the workflow engine in the following cases:

  • When a new ProcessDefinitionURL is set on a process instance. In this case, IProcessInstance::put_ProcessDefinitionURL() is called.
  • When a process instance is loaded. In this case, IProcessInstance::DataSource Property::Open() is called.

The IAuditTrail::Bind() method is called immediately after creation of the AuditTrailProvider object.

The workflow engine calls IAuditTrail::Bind(0) in the end of Advance Method and OnAbort Method to release the IProcessInstance pointer. If you are implementing an AuditTrailProvider, make sure it supports this behavior.

If you are implementing an event sink or calling the workflow engine from an ASP page, always call IAuditTrail::Bind(0) when the audit trail is not needed any more or goes out of scope. Otherwise neither the ProcessInstance object nor the AuditTrailProvider object will be destroyed.

Example

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.

[Visual Basic]

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

See Also

AuditTrailProvider Property

AuditTrailEventLog CoClass

IAuditTrail Interface

ProcessInstance CoClass

ProcessDefinitionURL Property

IProcessDefinition Interface

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.