WorkflowApplication.ResumeBookmark Method (String, Object, TimeSpan)

.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 bookmark with the specified name, using the specified value and time-out interval. 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(
	string bookmarkName,
	object value,
	TimeSpan timeout


Type: System.String

The name of the bookmark to be resumed.

Type: System.Object

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

Type: System.TimeSpan

The time interval during which the bookmark must be resumed.

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.
// Bookmark resumption only occurs when the workflow
// is idle. If a call to ResumeBookmark is made and the workflow
// is not idle, ResumeBookmark blocks until the workflow becomes
// idle before resuming the bookmark.
BookmarkResumptionResult result = wfApp.ResumeBookmark("UserName", 

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

.NET Framework
Available since 4.0
Return to top