WorkflowApplication.ResumeBookmark Method (Bookmark, Object)

.NET Framework (current version)

The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Initiates an operation to resume the specified bookmark, using the specified value. The bookmark to be resumed is previously created by an activity within the workflow instance.

Namespace:   System.Activities
Assembly:  System.Activities (in System.Activities.dll)

public BookmarkResumptionResult ResumeBookmark(
	Bookmark bookmark,
	object value


Type: System.Activities.Bookmark

The bookmark to resume.

Type: System.Object

An object passed as a parameter to the method that is invoked when the bookmark resumes.

Return Value

Type: System.Activities.BookmarkResumptionResult

The result of the bookmark resumption operation.

The bookmark result indicates whether the resumption operation succeeded or failed.

The following example creates a workflow that uses a ReadLine activity that creates a Bookmark. The workflow is started, and once the Bookmark is created and the workflow goes idle, the user's input is gathered and the bookmark is resumed.

public sealed class ReadLine : NativeActivity<string>
    public InArgument<string> BookmarkName { get; set; }

    protected override void Execute(NativeActivityContext context)
        // Create a Bookmark and wait for it to be resumed.
            new BookmarkCallback(OnResumeBookmark));

    // NativeActivity derived activities that do asynchronous operations by calling 
    // one of the CreateBookmark overloads defined on System.Activities.NativeActivityContext 
    // must override the CanInduceIdle property and return true.
    protected override bool CanInduceIdle
        get { return true; }

    public void OnResumeBookmark(NativeActivityContext context, Bookmark bookmark, object obj)
        // When the Bookmark is resumed, assign its value to
        // the Result argument.
        Result.Set(context, (string)obj);
Variable<string> name = new Variable<string>();

Activity wf = new Sequence
    Variables = { name },
    Activities =
         new WriteLine
             Text = "What is your name?"
         new ReadLine
             BookmarkName = "UserName",
             Result = new OutArgument<string>(name)

         new WriteLine
             Text = new InArgument<string>((env) => 
                 ("Hello, " + name.Get(env)))

// Create a WorkflowApplication instance.
WorkflowApplication wfApp = new WorkflowApplication(wf);

// Workflow lifecycle events omitted except idle.
AutoResetEvent idleEvent = new AutoResetEvent(false);

wfApp.Idle = delegate(WorkflowApplicationIdleEventArgs e)

// Run the workflow.

// Wait for the workflow to go idle before gathering
// the user's input.

// Gather the user's input and resume the bookmark.
BookmarkResumptionResult result = wfApp.ResumeBookmark(new Bookmark("UserName"), 

// Possible BookmarkResumptionResult values:
// Success, NotFound, or NotReady
Console.WriteLine("BookmarkResumptionResult: {0}", result);

.NET Framework
Available since 4.0
Return to top