Using Web Workflow Roles Sample

Download sample

The sample demonstrates how to use Web roles in a workflow.

The high level scenario is as follows:

  1. A SequentialWorkflowActivity activity named PurchaseOrderWorkflow is instantiated.

  2. The employees who can initiate the PurchaseOrderWorkflow are limited to the persons who are specified in the WebWorkflowRole object that is created in the workflow.

The HandleExternalEventActivity activity initiates a purchase order only if the initiator is a member of the configured Web roles. The initiator (employee) identity is assumed to be the identity of the person who is running the workflow sample.

To set up, build, and run the sample

  1. Download the sample by clicking Download Sample.

    This extracts the sample project to your local hard disk.

  2. Open a command prompt and go to the %windir%\Microsoft.NET\Framework\v2.0.50727\ directory.

  3. Run aspnet_regsql.exe to set up and configure the ASP.NET databases.

  4. Click Start, point to Programs, point to Microsoft Windows SDK, and then click CMD Shell.

  5. Go to the source directory of the sample.

  6. At the command prompt, type MSBUILD <Solution file name>.

    In the sample, the initiating user is set to be Amanda. The role that is configured on the HandleExternalEventActivity activity is Clerk.

  7. To run the sample, run the .exe file in the PurchaseOrderWorkflow\bin\debug folder (or the PurchaseOrderWorkflow\bin folder for the Visual Basic version of the sample), which is located below the source folder of the sample.

  8. In the Program.cs file, change the initiating user to someone other than Amanda.

    Build and run the sample again to verify that the purchase order was not approved.

See Also



Other Resources

Roles Samples
Using Roles in Workflows

© 2007 Microsoft Corporation. All rights reserved.