WorkflowRuntime.GetWorkflow(Guid) WorkflowRuntime.GetWorkflow(Guid) WorkflowRuntime.GetWorkflow(Guid) WorkflowRuntime.GetWorkflow(Guid) Method


Retrieves the workflow instance that has the specified Guid.

 System::Workflow::Runtime::WorkflowInstance ^ GetWorkflow(Guid instanceId);
public System.Workflow.Runtime.WorkflowInstance GetWorkflow (Guid instanceId);
member this.GetWorkflow : Guid -> System.Workflow.Runtime.WorkflowInstance
Public Function GetWorkflow (instanceId As Guid) As WorkflowInstance


Guid Guid Guid Guid

The Guid of a workflow instance.




The following code example demonstrates a ReloadWorkflow method that calls the GetWorkflow method. The ReloadWorkflow method is part of a larger class that has a Runtime property to access all of the methods, properties, and events of the WorkflowRuntime class.

This code example is part of the Custom Persistence Service Sample sample.


In the example, the call to Load is redundant because both the GetWorkflow and Load methods use the same internal helper method to load the workflow instance into memory.

private void ReloadWorkflow(object id)
    // Reload the workflow so that it will continue processing
Private Sub ReloadWorkflow(ByVal id As Object)
    ' Reload the workflow so that it will continue processing
    Me.Runtime.GetWorkflow(CType(id, Guid)).Load()
End Sub


If instanceId specifies a workflow instance that is not currently in memory, the workflow instance is loaded into memory and scheduled for execution. For example, after a workflow instance is aborted, you can call GetWorkflow to load the workflow instance back into memory. In this case, the last persisted state of the workflow instance is loaded into memory by the persistence service.

Applies to