Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
Previous Versions
.NET Framework 3.0
Class Library
 GetWorkflow Method
Collapse All/Expand All Collapse All
This page is specific to
.NET Framework 3.0

Other versions are also available for the following:
WorkflowRuntime.GetWorkflow Method
Retrieves the workflow instance that has the specified Guid.

Namespace: System.Workflow.Runtime
Assembly: System.Workflow.Runtime (in system.workflow.runtime.dll)

Visual Basic (Declaration)
Public Function GetWorkflow ( _
    instanceId As Guid _
) As WorkflowInstance
Visual Basic (Usage)
Dim instance As WorkflowRuntime
Dim instanceId As Guid
Dim returnValue As WorkflowInstance

returnValue = instance.GetWorkflow(instanceId)
C#
public WorkflowInstance GetWorkflow (
    Guid instanceId
)
C++
public:
WorkflowInstance^ GetWorkflow (
    Guid instanceId
)
J#
public WorkflowInstance GetWorkflow (
    Guid instanceId
)
JScript
public function GetWorkflow (
    instanceId : Guid
) : WorkflowInstance
XAML
Not applicable.

Parameters

instanceId

The Guid of a workflow instance.

Return Value

The WorkflowInstance that has the specified Guid.
Exception typeCondition

InvalidOperationException

The WorkflowRuntime is not started

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 has been aborted, you can call GetWorkflow to load the workflow instance back into memory. In this case, the last persisted state of the workflow instance will be loaded into memory by the persistence service.

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 SDK sample from the Program.cs file. For more information, see Custom Persistence Service.

NoteNote:

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.

C#
private void ReloadWorkflow(object id)
{
    // Reload the workflow so that it will continue processing
    this.Runtime.GetWorkflow((Guid)id).Load();
}

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
WorkflowInstance Not Found      Jerry Camel   |   Edit   |   Show History
If the WorkflowInstance with the specified GUID is not found either in memory or in the persistence store, an InvalidOperationException is thrown.
Tags What's this?: Add a tag
Flag as ContentBug
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement | Site Feedback
Page view tracker