ExecuteAction Method
ExecuteAction 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.
The workflow engine calls this method when the matching row in the action table specifies a custom Component Object Model (COM) object as the action. The custom COM object must implement this method.
Applies To
Type Library
Microsoft CDO Workflow Objects for Microsoft Exchange
DLL Implemented In
CDOWF.DLL
Syntax
[Visual Basic]Function ExecuteAction
(
pSession As WorkflowSession
)
[C++]HRESULT ExecuteAction ( IWorkflowSession* pSession );
Parameters
- pSession
Return Value
Returns S_OK if successful, or an error value otherwise.
Remarks
When your action table includes the programmatic identifier (PROGID) of a custom COM object as an action, the workflow engine creates an instance of your COM object and calls the ExecuteAction method that your COM object has implemented. COM objects can only be created in privileged-mode workflows, so the engine checks whether this ProcessInstance belongs to a privileged-mode workflow. For more information, see the Mode Property.
Example
To use this interface, you need to create your own COM object. If you implemented the following code in a dynamic-link library (DLL) and used the PROGID of your dynamic-link library (DLL) in the Action field of a row in your workflow action table, when the workflow engine used that row the following action would execute:
[Visual Basic]
Implements CDOWF.ICustomActivity
Sub SendMail(MySubject, ByVal pSession As CDOWF.IWorkflowSession)
Set MyMsg = CreateObject("CDO.Message")
With MyMsg
.From = pSession.Sender
.To = "someone@example.com"
.Subject = MySubject
.TextBody = pSession.StateFrom & " -> " & pSession.StateTo
.Send
End With
End Sub
Sub ICustomActivity_CompensatingAction(ByVal pSession As CDOWF.IWorkflowSession)
End Sub
Function ICustomActivity_EvaluateCondition(ByVal pSession As CDOWF.IWorkflowSession) As Boolean
End Function
Sub ICustomActivity_ExecuteAction(ByVal pSession As CDOWF.IWorkflowSession)
Dim FieldType
Dim CurrentState
CurrentState = ""
FieldType = 8 ' BSTR
SendMail "OnCreate Event", pSession
pSession.AuditTrail.AddEntry "WorkflowSession AuditTrail AddEntry is working"
CurrentState = pSession.Record.fields("https://schemas.microsoft.com/cdo/workflow/currentstate").Value
If CurrentState <> "" Then
pSession.Record.fields.Append CStr(CurrentState), FieldType, , , CStr(CurrentState)
pSession.Record.fields.Update
End If
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.