Outlook Workflow Wizard Sample
This sample demonstrates how a separate development environment/execution environment can be created outside of Visual Studio, through rehosting the workflow designer in a Windows Forms application. It also demonstrates how you can use the workflow object model to create a workflow definition that can be viewed by using the workflow designer tool instead of Visual Studio. The class that is used to host the designer is called WorkflowView. This class is responsible for displaying a workflow definition in a Windows Forms application.
Using the Sample
The application mimics the process that is used by the Microsoft Office Outlook Rules Wizard. The following illustration shows the first step of the wizard.
The first step of the wizard is to select the folder that the rule will be executed against. After selecting the folder, the user can click Next or select the Condition tab directly.
The second step is to define the type of condition to be used to determine which e-mails will be affected, as shown in the following illustration.
Select Enter Text Here to specify the string used in the comparison; when the rule is executed, the Subject, From, To, CC, or BCC fields are searched for the provided string. Only one of the conditions is used per rule. After selecting the condition, the user clicks Next.
The user can then define the Actions that must be followed when e-mails are found that meet the condition criteria. This step is shown in the following illustration.
On the Actions page, the user can choose to create an AutoReply e-mail message, an Outlook Note, or an Outlook Task, which are executed for the messages that match the provided conditions. After these actions are selected, the user clicks Next to move on to rule selection.
On the Execute tab, the user can create a workflow definition by serializing the internal workflow object model that defines the workflow into XML. This file can be imported and viewed inside Visual Studio. The only requirement for its correct viewing is that the workflow project must include/reference the activities used by this application sample.
After the workflow definition is generated, the user can compile the workflow and produce an assembly by clicking Compile Workflow Definition. Generating the workflow assembly enables the user to execute an instance of the workflow definition by clicking Start Workflow Definition.
A textual representation of the workflow is dynamically created and displayed in the Workflow Description area of the application. A pictorial representation of the workflow is dynamically created and updated in the Sequential Workflow side of the application.
This sample was designed to be run with Office 11. If you are using Office 12, change the reference in the ReadEmailActivity project.
To build the sample
Download the sample by clicking Download Sample in this topic.
This extracts the sample project to your local hard disk.
Click Start, point to Programs, point to Microsoft Windows SDK, and then click CMD Shell.
Go to the source directory of the sample.
At the command prompt, type MSBUILD <Solution file name>.
To run the sample
In the SDK Command Prompt window, run the .exe file in the OutlookWorkflowWizard\bin\debug folder (or the OutlookWorkflowWizard\bin folder for the Visual Basic version of the sample), which is located below the main folder for the sample.
Be sure to run the wizard from the current working directory; otherwise, the XAML file will not be created in the correct location.
© 2007 Microsoft Corporation. All rights reserved.