17
Creating Workflows for Windows SharePoint Services Table of Contents Creating Workflows for Windows SharePoint Services ........................................................... 1 Exercise 1 Building a Workflow with Office SharePoint Designer 2007...................................................................... 2 Exercise 2 Building a Custom Workflow with Visual Studio ...................................................................................... 8 Conclusion ................................................................................................................................................................... 16

Creating Workflows Windows Share Point Services

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 1: Creating Workflows Windows Share Point Services

Creating Workflows for Windows SharePoint Services

Table of Contents

Creating Workflows for Windows SharePoint Services ........................................................... 1

Exercise 1 Building a Workflow with Office SharePoint Designer 2007......................................................................2

Exercise 2 Building a Custom Workflow with Visual Studio ......................................................................................8

Conclusion...................................................................................................................................................................16

Page 2: Creating Workflows Windows Share Point Services

Creating Workflows for Windows SharePoint Services

Page 1 of 16

Creating Workflows for Windows SharePoint Services

Objectives After completing this lab, you will be better able to:

� Build a Workflow with Office SharePoint Designer 2007.

� Build a Custom Workflow with Visual Studio.

� Seamlessly integrate workflow functionality with the 2007 Microsoft® Office System release.

Estimated Time to Complete This Lab

90 Minutes

Computer used in this Lab

MOSS

Page 3: Creating Workflows Windows Share Point Services

Creating Workflows for Windows SharePoint Services

Page 2 of 16

Exercise 1 Building a Workflow with Office SharePoint Designer 2007

Scenario The city of Anytown, MI, needs an electronic process for building permit applications submitted by residents and business owners. This process requires that users be able to access a building permit application Office InfoPath 2007 form from the browser. After providing specific data about the project in the form, the user submits the data to an internal SharePoint form library, where it is assigned to a compliance reviewer for approval. The compliance reviewer uses the same form as a rich client to determine if the project meets certain requirements (for example, fire safety regulations) before submitting the form back to the form library. If all requirements have been met, an e-mail message is sent to the applicant indicating that the application has been approved and that the permit amount is due.

In this exercise, you will use Office SharePoint Designer 2007 to build this workflow process. Office SharePoint Designer 2007 enables site administrators to write workflow logic against any SharePoint list. Within the Workflow Designer users can specify action sets, which contain conditions and actions, without having to write any custom code. These action sets work with any form fields that have been promoted as SharePoint columns.

Tasks Detailed Steps

Complete the following

6 tasks on:

MOSS

1. Become familiar

with the Views task

pane

Note: Before working with Office SharePoint Designer 2007, it would be beneficial

for you to become familiar with the building permit application form template, which

has already been deployed to a SharePoint form library. This template is meant for

two types of users: (1) residents and business owners, and (2) compliance reviewers.

The residents and business owners (the applicants) provide building project

information, including the building size, lot size, property tax, project size, and project

cost. These values are used to calculate a permit amount. In addition, the Anytown,

MI, employee who will be assigned to review the application is determined based on

the selection of project type (for example, building extension). After the applicant

submits the form data to a SharePoint form library, the assigned compliance reviewer

then completes the compliance section, which will determine if the permit is approved

or rejected.

There is a form view for each type of user, with two form views for the applicant. The

View 1 (default) view is the one that is shown when the applicant first fills out the

form. The Initiator Rejected view is shown to the applicant if any of the compliance

requirements are not met, and allows that user to see comments from the reviewer.

a. Login using the following credentials:

• Username: administrator

• Password: pass@word1

• Log on to: LITWAREINC

b. Wait for the Warmup Script to complete and the popup window to close.

c. From Windows Explorer, navigate to C:\HOL\CreatingWorkflows\Exercise1.

d. Right-click BuildingPermitApplication.xsn and select the Design menu

command.

e. In the Design Tasks task pane, click Views.

f. In the Views task pane, click each form view to become familiar with the different

UI sections of the form.

2. View the Form’s

Data Source screen Note: You will need to be familiar with the form’s data source in order to write the

workflow logic. Some of the top-level nodes that are worth noting are the RoleID,

PermitStatus and PermitAmount. The RoleID node identifies the current user viewing

the form, with values of 1 (the applicant) and 2 (the compliance reviewer). The

PermitStatus node identifies the status of the form, with values of OPEN (the default

Page 4: Creating Workflows Windows Share Point Services

Creating Workflows for Windows SharePoint Services

Page 3 of 16

Tasks Detailed Steps

value), REJECTED, or APPROVED. The PermitAmount node contains the value

that is calculated when the user clicks Calculate Permit Amount.

Note also that there are a number of fields that have been promoted as columns in the

SharePoint library. This promotion is done so that workflow logic can be written

against the form’s data source. Of course, it also allows users to review certain values

in forms in the SharePoint form library without having to open those forms.

a. Select the View | Data Source menu command.

b. In the Data Source task pane, hover over some of the top-level nodes to view the

corresponding data type and default value.

Note: The RoleID default value is 1 and the PermitStatus default value is OPEN.

c. Select the Tools | Forms Options menu command.

d. In the Form Options dialog box, click the Property Promotion category to

review promoted fields.

e. Click Cancel.

f. Close Office InfoPath 2007.

3. Create a new

Workflow in

SharePoint Designer

2007

Note: Now that you have some familiarity with the building permit application form

template, you can begin the task of designing the workflow. The Workflow Designer of

Office SharePoint Designer 2007 has a relatively simple UI that allows users to create

workflow logic for any SharePoint list. Action sets can be added for a workflow

similar to how rules can be added in the Office InfoPath 2007 designer. You can have

actions performed such as assigning a task or sending an e-mail message, and these

actions are executed based on the values of certain promoted fields in the form. You

can even dynamically add the values of promoted form fields to the bodies of e-mail

messages.

In this exercise, you will create a new workflow and associate it with the Building

Permit Application form library. You will use the Workflow Designer to (1) assign a

task to the correct compliance reviewer when a form is first submitted, and (2) send an

e-mail message to the applicant after the form has been reviewed.

a. Navigate to Start | All Programs | Microsoft Office | Microsoft Office

SharePoint Designer 12.

b. If SharePoint Designer does not open to http://moss.litwareinc.com/sites/permits

then click File, Open Site then type http://moss.litwareinc.com/sites/permits,

and click Open. This may take a few minutes to open and for the menu options to

activate.

c. In Microsoft Office SharePoint Designer 2007, select the File | New | Workflow

menu command.

d. In the Workflow Designer, change the SharePoint list value to Building Permit

Application. Leave the Workflow name as Workflow 1.

e. Select the Automatically start this workflow when a new item is created check

box.

f. Select the Automatically start this workflow whenever an item is changed

check box.

g. Click Next.

4. Specify Permit Status

and Define

Workflow Lookup

Note: Workflows are composed of steps, which are composed of action sets. Each

workflow step is processed in the order listed in the Workflow Steps task pane. Action

sets are also processed in the order listed within each step. Processing within a step

stops when one of its action sets evaluates to true. For this exercise, you will create

two action sets: one that assigns a task to a compliance reviewer and one that sends

an e-mail message to the applicant after the form has been reviewed.

The action to assign a task to the compliance reviewer occurs after a form is first

Page 5: Creating Workflows Windows Share Point Services

Creating Workflows for Windows SharePoint Services

Page 4 of 16

Tasks Detailed Steps

submitted to the SharePoint form library. If you recall from when you reviewed the

form template’s data source, the PermitStatus node identifies the current review

status of the building permit application. A value of OPEN indicates that the

application has not yet been reviewed, while values of APPROVED and REJECTED

indicate that the reviewer has either approved or rejected the application. Thus, you

will need to add a condition where the Permit Status promoted property value is

OPEN. Once the condition is specified, you use the Actions list to assign a task to the

compliance reviewer. For this set of steps, you will use the Custom Task Wizard to

define a custom task that is assigned to the value of the Reviewer Email promoted

property.

a. In the Workflow Designer, click the Conditions list and select Custom Condition

(Building Permit Application).

b. Click field and select Permit Status.

c. Click value, type OPEN and press ENTER.

d. Click the Actions list and select Assign a Todo Item.

e. Click a todo item.

f. In the first page of the Custom Task Wizard, click Next.

g. Type Review Building Permit Application in the Name field.

h. Type Perform a compliance review for the new building permit application

submitted to the form library in the Description field and click Finish.

i. Click these users.

j. In the Select Users dialog box, click Workflow Lookup in the list box and click

Add.

k. The Define Workflow Lookup dialog box should appear

l. Leave Source section entry with default value of Current Item. Select Reviewer

Email from the Field list in the Lookup Details section.

m. Click OK.

n. In the Select Users dialog box, click OK.

Note: The action to send an e-mail message to the applicant occurs after the

compliance reviewer has either approved or rejected the building permit application.

In the case of an approval, the Permit Status promoted property value changes to

APPROVED, and the applicant would receive an e-mail message identifying the

permit amount that is due to the city of Anytown, MI. If the application is rejected, the

Permit Status promoted property value changes to REJECTED, and the Role ID

value is set to 1. As a result of time constraints, you will build the action set only for

the approval message.

After setting the condition, use the Send an Email action to create the e-mail message

that is to be sent. Because the applicant’s e-mail address is a promoted property, you

can perform a workflow lookup and set the To field in the e-mail message to that

Page 6: Creating Workflows Windows Share Point Services

Creating Workflows for Windows SharePoint Services

Page 5 of 16

Tasks Detailed Steps

promoted property’s value. You can use promoted property values in the CC, Subject,

and message body fields as well. For this exercise, you will use the Permit Amount

promoted property value in the message body to indicate the amount owed by the

applicant for the permit.

o. Click Add ‘Else If’ Conditional Branch.

p. Click the new Conditions list and select Custom Condition (Building Permit

Application).

q. Click field and select Permit Status.

r. Click value, type APPROVED and press ENTER.

s. Click the new Actions list and select Send an Email.

t. Click this message.

u. In the Define Email Message dialog box, click the lookup button located to the

right of the To text box.

v. In the Select Users dialog box, click Workflow Lookup in the list box and click

Add.

w. In the Define Workflow Lookup dialog box, select Submitter (Email) from the

Field list in the Lookup Details section and click OK.

x. In the Select Users dialog box, click OK.

y. In the Define Email Message dialog box, type Your Building Permit

Application Has Been Approved in the Subject text box.

z. In the body text box, type The following amount is due to the city of Anytown,

MI, for the building permit: $.

aa. Reposition the cursor between the “$” and the “.” in the body text box. Click Add

Lookup to Body.

bb. In the Define Workflow Lookup dialog box, select Permit Amount from the

Field list in the Lookup Details section.

cc. Click OK.

dd. In the Define Email Message dialog box, click OK. Your workflow step should

now appear

ee. Click Finish to process and validate your changes and save the workflow.

ff. Close Office SharePoint Designer 2007

Page 7: Creating Workflows Windows Share Point Services

Creating Workflows for Windows SharePoint Services

Page 6 of 16

Tasks Detailed Steps

5. Test the Workflow Note: To test the workflow, you will need to log on as different users so that you can

simulate the actions of multiple roles. This machine is equipped with remote desktop

connections for NicoleC (the applicant) and DaveR (the reviewer). For the applicant,

a URL is provided for gaining access to the building permit application browser-

based form. The reviewer can access the form as a rich client from the Building

Permit Application form library.

Start the test by logging on as NicoleC. The applicant navigates to the browser-based

version of the building permit application and provides details about the project in the

form. Note that the individual to whom an associated design drawing is sent is

dependent on the value of the PROJECT TYPE list. For this exercise, you will not

have to submit a design drawing.

After all information has been provided, the applicant submits the data, which sends

the form file to the Building Permit Application form library and kicks off the

associated workflow that you created in the previous set of steps.

a. Double-click the Nicole Caron remote desktop connection shortcut on the

desktop.

b. In Internet Explorer, navigate to Favorites | Building Permit Application Form.

c. When the form starts, type R12-34567 in the Lot # text box and click Retrieve

Data to populate the property and owner fields.

d. Select Building Extension in the PROJECT TYPE list.

e. In the PROJECT ESTIMATES section, select 7/24/2006 as a Start Date and

7/28/2006 as an End Date.

f. Type 500 in the Size text box.

g. Type 12000 in the Cost text box.

h. Click Calculate Permit Amount.

i. Click Submit.

j. In the Microsoft Internet Explorer dialog box, click OK to confirm that the form

was submitted successfully.

k. Minimize the Nicole Caron remote desktop connection.

Note: Now, as the compliance reviewer (DaveR), you will navigate to your task list to

see if any tasks have been assigned. You can click the Title link in the task list to view

some of the task details. For now, you will navigate to the Building Permit

Application form library to review the new application from NicoleC.

From the form library, you can click the Name link to start the building permit

application form in the rich client. Because you still want to test whether the second

action set in your workflow is performing correctly, click Approved or NA for all of

the compliance items in the INTERNAL USE ONLY section. As long as none of these

items are set to Rejected, the form’s permit status value will change to APPROVED

on submit.

l. Double-click the Dave Richards remote desktop connection shortcut on the

desktop.

m. In Internet Explorer, navigate to Favorites | My Task List.

n. Click the link in the Link column of the Review Building Permit Application

task, if you are prompted to Open or Save choose to Open the file.

o. In the INTERNAL USE ONLY section of the form, click Approved or NA for

all compliance review items and click Submit.

Page 8: Creating Workflows Windows Share Point Services

Creating Workflows for Windows SharePoint Services

Page 7 of 16

Tasks Detailed Steps

p. In the Microsoft Office InfoPath dialog box, click OK to confirm that the form

was submitted successfully, if you are prompted to save you changes select no as

the submit has already saved them.

q. Minimize the Dave Richards remote desktop connection.

6. Verify the e-mail

was sent Note: The last task in this exercise is to confirm that an e-mail message was sent to the

applicant after the compliance reviewer approved the building permit application. You

can switch back to the NicoleC remote desktop connection and start Office Outlook

2007 to confirm receipt of the approval message. Within the body of that message,

note how the workflow lookup value (for the Permit Amount promoted property) is

resolved to 1500.

a. Maximize the Nicole Caron remote desktop connection.

b. Navigate to Start | All Programs | Microsoft Office | Microsoft Office Outlook

12.

c. Click Send/Receive.

Note: There may be a bug in this beta 2007 release that prevents workflow e-mail

messages from being sent.

d. Preview the message with the subject Your Building Permit Application Has

Been Approved.

Page 9: Creating Workflows Windows Share Point Services

Creating Workflows for Windows SharePoint Services

Page 8 of 16

Exercise 2 Building a Custom Workflow with Visual Studio

Scenario The Microsoft Office SharePoint Server 2007 Workflow Developer Starter Kit installs additional project templates and a Toolbox and Designer that developers can use to build custom Microsoft Office SharePoint Server 2007 workflows.

In this exercise you will create a new managed-code Workflow project using Microsoft Visual Studio 2005 with the Microsoft Office SharePoint Server 2007 Workflow Developer Starter Kit and deploy the workflow to a Microsoft Office SharePoint Server.

Tasks Detailed Steps

1. Create a new

Workflow project

using a Microsoft

Office SharePoint

Workflow project

template

a. Switch back to administrator desktop.

b. From Windows Explorer, navigate to

C:\HOL\CreatingWorkflows\Exercise2\OrderRequestWorkflow.

c. Double-click OrderRequestWorkflow.sln and Visual Studio will open.

Note: The Microsoft Office SharePoint Server 2007 Workflow Developer Starter Kit

Designer and Toolbox allow you to design a Workflow visually similar to designing a

Microsoft Office Visio 2007 flowchart. You will use the designer to layout a sequence

of activities and bind those activities to custom event handlers.

In our scenario, when the workflow is activated on a document in an Office

SharePoint Server 2007 document library, a Microsoft Office InfoPath 2007 form will

open in the browser. In this form you will enter a product description for the order

request, including a person to assign to the request. When the form is submitted, the

custom workflow will create a new Task Item and save the information entered in the

Office InfoPath 2007 form as Task Item properties. You will then log on as Luis

Bonifaz in an RDP session to open the request in a second Microsoft Office InfoPath

2007 form in the browser. You will review the request then mark it as Complete and

update the Task Item in Office SharePoint Server 2007 to finish the workflow.

First, you will add a number of workflow activities from the SharePoint Workflow

toolbox. These will provide the basic structure for the workflow, after which you will

start to add logic to those activities.

d. In the Solution Explorer, double-click Workflow1.cs.

e. From the SharePoint Workflow toolbox, drag a CreateTask activity into the

sequence after the onWorkflowActivated1 activity.

Page 10: Creating Workflows Windows Share Point Services

Creating Workflows for Windows SharePoint Services

Page 9 of 16

Tasks Detailed Steps

f. From the Windows Workflow toolbox, drag a While activity into the sequence

after the new createTask1 activity.

g. From the SharePoint Workflow toolbox, drag an OnTaskChanged activity and

drop it on the while1 activity.

h. Finally, drag a CompleteTask activity from the SharePoint Workflow toolbox

and drop it in the sequence after the while1 activity.

i. Your workflow should now look like

Note: You will bind and implement event handlers for the activities in the workflow

sequence you just designed. Visual Studio 2005 helps you generate much of the code

for the events. You just need to implement the logic.

First you will insert a few variables as data members that will be used to make

workflow decisions.

Note: If an error dialog appears while using the designer before finishing these steps

click OK to continue the Exercise.

j. Enter taskToken in the CorrelationToken property (found in the Properties

section) for each of the following activities: createTask1, onTaskChanged1, and

completeTask1.

Note: To get to the Properties for select the item in the designer and it will be

Page 11: Creating Workflows Windows Share Point Services

Creating Workflows for Windows SharePoint Services

Page 10 of 16

Tasks Detailed Steps

displayed in the Properties panel in the lower right hand corner of Visual Studio

k. Expand the CorrelationToken property for the createTask1 activity and set the

OwnerActivityName to Workflow1.

l. For those same activities, set the TaskId property of each to taskID.

• In order to do this you must put the mouse in the TaskID field and click on

the … button.

• For the first item select the Bind to a new member tab and enter taskID in

the New member name field then click OK.

• For the other items you would stay in the Bind to existing member tab and

select taskID and click OK.

m. For the createTask1 activity, set the TaskProperties property to taskProperties,

in order to do this you must put the mouse in the TaskProperties field and click on

the … button and select the Bind to new member tab then enter taskProperties in

the New member name field and then click OK.

n. For the onTaskChanged1 activity, set the AfterProperties property to

taskAfterProperties and the BeforeProperties property to

taskBeforeProperties, in order to do this you must put the mouse in the

AfterProperties or BeforeProperties fields and click on the … button and select the

Bind to new member tab then enter either taskBeforeProperties or

taskAfterProperties in the New member name field and then click OK.

o. Right-click the onWorkflowActivated1 activity and select Generate Handlers.

p. The code window opens with the cursor within the

onWokflowActivated1_Invoked event handler. Place the cursor just above the

onWokflowActivated1_Invoked event handler and insert code snippet

CreatingWorkflows > Exercise2 > Code1-DataMembers or type the following

code.

public Guid workflowId = default(System.Guid);

public

Microsoft.SharePoint.Workflow.SPWorkflowActivationProperti

es workflowProperties = new

Microsoft.SharePoint.Workflow.SPWorkflowActivationProperti

es();

public Guid taskID = default(System.Guid);

public

Page 12: Creating Workflows Windows Share Point Services

Creating Workflows for Windows SharePoint Services

Page 11 of 16

Tasks Detailed Steps

Microsoft.SharePoint.Workflow.SPWorkflowTaskProperties

taskProperties = new

Microsoft.SharePoint.Workflow.SPWorkflowTaskProperties();

public

Microsoft.SharePoint.Workflow.SPWorkflowTaskProperties

taskAfterProperties = new

Microsoft.SharePoint.Workflow.SPWorkflowTaskProperties();

public

Microsoft.SharePoint.Workflow.SPWorkflowTaskProperties

taskBeforeProperties = new

Microsoft.SharePoint.Workflow.SPWorkflowTaskProperties();

private string productDescription = default(String);

private string orderStatus = default(String);

private string assignedUser = null;

private string defaultUser = null;

private bool statusComplete = false;

Note: Next you will implement code that will run when the workflow is Activated. This

code will set data members to establish the initial workflow state.

q. Within the onWorkflowActivated1_Invoked event handler, insert code snippet

CreatingWorkflows > Exercise2 > Code2-WorkflowActivated or type the

following code.

private void onWorkflowActivated1_Invoked(object sender,

ExternalDataEventArgs e)

{

this.workflowId = this.workflowProperties.WorkflowId;

this.productDescription = "Part #A123-45-6.";

this.orderStatus =

this.workflowProperties.InitiationData;

this.assignedUser =

this.workflowProperties.Originator;

this.defaultUser = this.workflowProperties.Originator;

}

Note: Now you will use the Designer to generate handlers for key events and generate

a few workflow properties as well.

r. In the Workflow1.cs [Design] right-click the createTask1 activity and select

Generate Handlers.

s. When the code windows opens, within the createTask1_MethodInvoking event

handler, insert code snippet CreatingWorkflows > Exercise2 > Code3-CreateTask

or type the following code.

private void createTask1_MethodInvoking(object sender,

EventArgs e)

{

this.taskID = Guid.NewGuid();

if (assignedUser != null)

this.taskProperties.AssignedTo =

this.assignedUser;

else

this.taskProperties.AssignedTo = this.defaultUser;

this.taskProperties.Title = "New Order Request";

this.taskProperties.Description = "Created by Windows

Page 13: Creating Workflows Windows Share Point Services

Creating Workflows for Windows SharePoint Services

Page 12 of 16

Tasks Detailed Steps

Workflow Foundation";

this.taskProperties.ExtendedProperties["Status"] =

"Open";

this.taskProperties.ExtendedProperties["Description"]

= this.productDescription;

this.taskProperties.TaskType = 0;

}

Note: Here you will generate a condition for the workflow to make the decision to

proceed to the next step in our sequence.

t. Return to the Workflow1.cs [Design] tab and select the while1 activity.

u. For the Condition property, select Code Condition, expand the property and type

taskNotComplete as the Condition, and press Enter.

v. When the code window opens, replace the default return statement within the

taskNotComplete event handler with code snippet CreatingWorkflows >

Exercise2 > Code4-TaskNotComplete or type the following code.

private void taskNotComplete(object sender,

ConditionalEventArgs e)

{

e.Result = !statusComplete;

}

Note: Finally, you will generate a handler that will complete the workflow.

w. Return to the Workflow1.cs [Design] tab, right-click the onTaskChanged1

activity and select Generate Handlers.

x. When the code window opens, within the onTaskChanged1_Invoked event

handler, insert code snippet CreatingWorkflows > Exercise2 > Code5-

TaskChanged or type the following code.

private void onTaskChanged1_Invoked(object sender,

ExternalDataEventArgs e)

{

statusComplete =

this.taskAfterProperties.ExtendedProperties.ContainsValue(

"Complete");

}

Note: Before you build the solution it needs to be signed. Microsoft Visual Studio 2005

makes it easy to create a Strong Name Key file for your project. You can choose an

existing key file to use as well, but you will use the project Properties to add a new key

file.

y. Click Project | OrderRequestWorkflow Properties.

z. Click Signing and select the Sign the assembly check box.

Page 14: Creating Workflows Windows Share Point Services

Creating Workflows for Windows SharePoint Services

Page 13 of 16

Tasks Detailed Steps

aa. Select <New…> in the list and enter demokey.snk.

bb. Clear the Protect my key with a password check box and click OK.

cc. Save the project and click Build | Build OrderRequestWorkflow, ensuring no

errors.

2. Deploy the

Workflow

a. From the Solution Explorer open and examine the feature.xml, workflow.xml,

and Install.bat files.

b. When reviewing these files, look for placeholders to see what editing will be

required for each file. The following example is from the feature.xml file.

<!-- Customize the text in square brackets.

Remove brackets when filling in, e.g.

Id="[UNIQUE GUID]" ==> Id="328B9FAF-0E29-46b1-92B3-

71F7D1D67761" -->

<Feature Id="[UNIQUE GUID (different from the guid/id in

your workflow.xml file)]"

Title="[TITLE OF WORKFLOW]"

Description="[DESCRIPTION FOR WHAT THIS WORKFLOW

DOES]"

c. When you have finished reviewing the files, close all three. They will be replaced

with previously edited versions.

d. Rename those files to feature_TEMPLATE.xml, workflow_TEMPLATE.xml,

and Install_TEMPLATE.bat or delete them.

e. In Windows Explorer, navigate to

C:\HOL\CreatingWorkflows\Exercise2\Deployment and copy all 4 files.

f. Paste those files into the project folder,

C:\HOL\CreatingWorkflows\Exercise2\OrderRequestWorkflow\OrderReque

stWorkflow.

3. Add the

OrderRequestWorkfl

ow.dll file you just

built to the Global

Assembly Cache

(GAC).

Note: The steps in this section demonstrate how to obtain the Public Key Token value

from our assembly in the GAC. Since you signed the assembly with a new Strong

Name Key, this value was unknown until you built the project. For this reason, you

will manually add the DLL to the GAC in order to identify the Public Key Token value.

If in the future you use a consistent key file in the signing steps, this value would also

be consistent, and you would not need to manually add the DLL – the deployment

process handles this.

Page 15: Creating Workflows Windows Share Point Services

Creating Workflows for Windows SharePoint Services

Page 14 of 16

Tasks Detailed Steps

a. Navigate further to

C:\HOL\CreatingWorkflows\Exercise2\OrderRequestWorkflow\

OrderRequestWorkflow\bin\Debug.

b. Open a second Windows Explorer window and navigate to

C:\WINDOWS\assembly. (This is the GAC.)

c. Drag OrderRequestWorkflow.dll from

C:\HOL\CreatingWorkflows\Exercise2\OrderRequestWorkflow\

OrderRequestWorkflow\bin\Debug into C:\WINDOWS\assembly.

Note: From the assembly, you will copy the Public Key Token value so that you can

specify that value in the workflow.xml file.

d. In the C:\WINDOWS\assembly window, scroll to find the

OrderRequestWorkflow assembly

e. Right-click the assembly and select Properties

f. Select and copy (CTRL-C) the Public Key Token value to the clipboard.

Page 16: Creating Workflows Windows Share Point Services

Creating Workflows for Windows SharePoint Services

Page 15 of 16

Tasks Detailed Steps

g. Close the C:\WINDOWS\assembly window.

h. In the open Windows Explorer window, navigate back to

C:\HOL\CreatingWorkflows\Exercise2\OrderRequestWorkflow\

OrderRequestWorkflow.

i. Right-click the workflow.xml file and select Open With | Notepad.

j. Find the CodeBesideAssembly attribute and at the end of that line replace the

PublicKeyToken value by pasting (CTRL-V) the value you copied previously.

k. Save and close the workflow.xml file.

l. Navigate to C:\HOL\CreatingWorkflows\Exercise2 and copy the Forms folder

and paste it into the project folder

(C:\HOL\CreatingWorkflows\Exercise2\OrderRequestWorkflow\OrderRequ

estWorkflow).

m. While still in Windows Explorer, double-click MyInstall.cmd in the Deployment

folder to start deployment of the workflow to SharePoint

Note: The following warning is normal on first run:

Object reference not set to an instance of an object.

Feature 'fb0e52e0-a7da-11da-a746-0800200c9a66' is not installed in this farm.

If no other errors appear, deployment was successful.

4. Edit the Workflow

Settings

a. Launch Internet Explorer.

b. Enter http://moss.litwareinc.com/sites/workflow and click Orders from the

Quick Launch pane to open the document library.

c. Click Settings | Document Library Settings and under Permissions and Policies

click Workflow settings.

d. In the Select a workflow template list, click Order Request Workflow and type

Page 17: Creating Workflows Windows Share Point Services

Creating Workflows for Windows SharePoint Services

Page 16 of 16

Tasks Detailed Steps

Order Request Workflow as the unique name for the workflow.

e. Leave the defaults for the rest of the form.

f. Click Next and click Submit on the page that follows.

g. Click on the breadcrumb at the top of the page to return to Orders.

5. Test the Workflow a. In the Orders library, hover the mouse over the AdventureWorks Q1 2003

document, click the arrow and select Workflows in the context menu.

b. Under Start a New Workflow, click Order Request Workflow.

c. Once the form has been posted you are returned to the Orders library.

d. Notice the column Order Request Workflow states that a workflow for the

document is In Progress.

e. Select Tasks from the Quick Launch pane.

f. Click the New Order Request list item to review the request.

g. Change the Status to Complete and click Update.

h. You are returned to the Tasks list and the task Status is now marked Completed.

i. Click Orders to return to the document library.

j. Notice the Order Request Workflow column now states that the workflow for the

document is Completed.

Conclusion

In this lab, you used Microsoft Office SharePoint Designer 2007 to design a custom workflow triggered on file creation or change. Within the workflow designer, you used out-of-the-box actions such as assigning a task or sending an e-mail message based on promoted values in your form data. In addition, you learned how to build a custom workflow using the Windows Workflow Foundation plug-in to Microsoft Visual Studio 2005 and deploy that workflow to Windows SharePoint Services (version 3). Both exercises demonstrated how workflow functionality can be seamlessly integrated with the 2007 Microsoft® Office System release.