HandleExternalEventActivity.OnInvoked(EventArgs) HandleExternalEventActivity.OnInvoked(EventArgs) HandleExternalEventActivity.OnInvoked(EventArgs) HandleExternalEventActivity.OnInvoked(EventArgs) Method


Called just after the external event is received to allow derived classes to process the inbound EventArgs before the activity closes.

 virtual void OnInvoked(EventArgs ^ e);
protected virtual void OnInvoked (EventArgs e);
abstract member OnInvoked : EventArgs -> unit
override this.OnInvoked : EventArgs -> unit
Protected Overridable Sub OnInvoked (e As EventArgs)


EventArgs EventArgs EventArgs EventArgs

The EventArgs that are received from the external event that was just received.


The following example shows an implementation of the OnInvoked method. This example is from the Correlated Local Service SDK sample, from the TaskCompleted.cs file. For more information, see Correlated Local Service Sample.

private WorkflowQueue CreateQueue(ActivityExecutionContext context)
    WorkflowQueuingService qService = context.GetService<WorkflowQueuingService>();

    if (!qService.Exists(this.QueueName))
        qService.CreateWorkflowQueue(this.QueueName, true);

    return qService.GetWorkflowQueue(this.QueueName);
Private Function CreateQueue(ByVal context As ActivityExecutionContext) As WorkflowQueue
    Dim qService As WorkflowQueuingService = context.GetService(Of WorkflowQueuingService)()

    If Not qService.Exists(Me.queueName) Then
        qService.CreateWorkflowQueue(Me.queueName, True)
    End If

    Return qService.GetWorkflowQueue(Me.QueueName)
End Function


The most common use of the OnInvoked method in derived classes is to extract members from the received EventArgs to set the values of the derived-classed activity's public properties.

Applies to

See also