Export (0) Print
Expand All
Expand Minimize

Workflow Samples that Extend SharePoint Team Services

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.
 

Koji Kato, Theresa Venhuis, Amit Chopra
Microsoft Corporation

April 2001

Applies to:
     Microsoft® Office XP Developer

Summary: This article describes how to work with samples to enhance the Web sites based on SharePoint Team Services from Microsoft by enforcing business rules through workflow processes. (12 printed pages)

Download Wfspsamp.exe.


Contents

Introduction
Wf4doclib.wfs—Document Library
Wf4list.wfs—List

Introduction

This article focuses on providing instructions to enhance List and Document Library features in a Microsoft® SharePoint™ team Web site using samples. Lists and document libraries in SharePoint team Web sites are stored as tables on Microsoft SQL Server™ and both will be referred to as interactive lists hereafter. Microsoft Office XP Developer provides the Workflow Designer for SQL Server™, which is used to workflow enable tables in Microsoft SQL Server.

Readers are assumed to have familiarity with SharePoint team Web sites, Microsoft SQL Server management, Microsoft Visual Basic® Scripting Edition (VBScript), and Microsoft ActiveX® Data Objects (ADO). Microsoft SQL Server 2000 must be installed on the computer where the SharePoint team Web sites will be created. This requirement comes from Microsoft Office XP Developer prerequisites. The recommended operating system for this article is Microsoft® Windows® 2000.

This article assumes the following:

  • A standard SharePoint team Web site has been established for the Default Web site on the computer where SharePoint team Web sites will be created.
  • The database for the SharePoint team Web site will be on the same computer.
  • You are working on the computer where SharePoint team Web sites will be created with Microsoft Office XP Developer fully installed including Workflow Services for SQL Server.
  • The SMTP service is installed correctly and configured to send e-mail.

This article provides two samples, Wf4doclib.wfs and Wf4list.wfs (follow the link above to the wfspsamp.exe sample file that contains these samples). Wf4doclib.wfs is a three-stage reviewer workflow designed for a document library. Wf4list.wfs is a three-stage reviewer workflow designed for a list, with image integration features to visualize approvals using images (for example, signatures, endorsement stamps). Follow these steps to create a SharePoint Team Services document library and list with workflow.

The sample code provided is designed to work only when following all the steps provided in sequential order in this article, and cannot be guaranteed to run correctly in another solution.

Wf4doclib.wfs—Document Library

Creating a SharePoint Team Services Document Library

SharePoint Team Services document libraries can be created with a browser.

  1. Navigate to your SharePoint team Web site.
  2. Select Documents on the top of the page to navigate to the Document Libraries page.
  3. Select New Document Library to navigate to the New Document Library page.
    • Enter WFD in the Name field.
    • Enter Document Library with Workflow in the Description field.
    • Click Yes to show this list on the Quick Launch bar.
  4. Select Create.

Adding Workflow

Existing workflow can be added to SharePoint Team Services Document Libraries from the Workflow Designer for SQL Server.

  1. From the Start menu, select Programs, Microsoft Office XP Developer, and then Microsoft Development Environment.
  2. From the File menu, select New, and select then Project, to open the New Project dialog box.
    • Select Office Developer Projects in the set of Project Types icons.
    • Select SQL Server Workflow Project in the set of Templates icons.
    • Enter SharePoint in the Name text box.
    • Leave the location of the project as the default.
  3. Click OK, to open the Create a new SQL Server Workflow Project dialog box.
    • Select the computer on which your SharePoint team Web site resides in the Select a Server drop-down list box.
    • Select the database computer _LM_W3SVC_1_Collab for your SharePoint team Web site.
  4. Click OK to open the Database Registration dialog box.
  5. Click OK to proceed with adding workflow to your SharePoint Team Services database.
  6. Right-click Workflow Processes in the Solution Explorer, and select Add Existing Workflow to open the Specify existing workflow file dialog box.
    • Browse to wf4doclib.wfs in the sample, and select it.
  7. Select Open to launch the Add Workflow Process dialog box.
    • Select ows_Project1_u_WFD in the Main or detail user table drop-down list box.
  8. Click OK to open the workflow process for editing.
  9. Select ows_Project1_u_WFDWorkflow in the Solution Explorer, and make sure the EnableWorkflow property is True in the Properties Window. If it is False, select True from the drop-down list box.
  10. Select ows_Project1_u_WFDWorkflow in the Solution Explorer, and make sure the DeletedRowsAvailable property is True in the Properties Window. If it is False, select True from the drop-down list box.
  11. From the File menu, select Save All.

Customizing SharePoint Team Web Sites

The customization features built-in to SharePoint team Web sites are used to create user interface elements through which users interact with workflow. Copy wf4doclib.xls before proceeding. This Microsoft® Excel file will be imported into the SharePoint team Web site as a list of states for the workflow created earlier.

  1. Navigate to your SharePoint team Web site.
  2. Select Lists on the top of the page to navigate to the Lists page.
  3. Select New List to navigate to the Create page.
  4. Select Import Spreadsheet to navigate to the New List page.
    • Enter State for WFD in the Name field.
    • Enter Lookup list for states in the Workflow in the Description field.
    • Browse to wf4doclib.xls in the sample by clicking Browse, and select the Excel file in the Choose File dialog box.
    • Select Open to navigate back to the New List page.
    • Select No to not show this list on the Quick Launch bar.
  5. Select Import to have Excel launch. Select the list in the Excel file as a range.
  6. Select Import in the Import to SharePoint List dialog box in Excel.
  7. Confirm that the whole list was imported into the State for WFD list.
  8. Select Documents on the top of the page to navigate to the Document Libraries page.
  9. Select WFD to navigate to the previously created list.
  10. Select Modify settings and columns to navigate to the Customize page.
  11. Select Add a new column in the Columns section of the Customize page to navigate to the Add Column page.
    • Enter State in the Column name field.
    • Select Lookup as the type of information.
    • Select State for WFD in the Get information from drop-down list box.
    • Click OK to navigate back to the Customize page.
  12. Select Add a new column in the Columns section of the Customize page to navigate to the Add Column page.
    • Enter Reviewer1 in the Column name field.
    • Select Lookup as the type of information.
    • Accept default User Information for Get information from drop-down list box.
    • Click OK to navigate back to the Customize page.
  13. Select Add a new column in the Columns section of the Customize page, to navigate to the Add Column page.
    • Enter Reviewer2 in the Column name field.
    • Select Lookup as the type of information.
    • Accept default User Information for Get information from drop-down list box.
    • Click OK to navigate back to the Customize page.
  14. Select Add a new column in the Columns section of the Customize page to navigate to the Add Column page.
    • Enter Reviewer3 in the Column name field.
    • Select Lookup as the type of information.
    • Accept default User Information for Get information from drop-down list box.
    • Click OK to navigate back to the Customize page.
  15. Select Go back to "WFD" to return to the WFD page.

Changing the Table Design

A minor change in the table design is required to hook up the user interface elements, created using the built-in customization features of SharePoint Team Services, to the workflow.

  1. From the Start menu, select Programs, Microsoft SQL Server, and then select Enterprise Manager.
  2. Expand the following nodes: Console Root | Microsoft SQL Server | SQL Server Group | computer | Databases | computer _LM_W3SVC_1_Collab | Tables.
  3. Right-click ows_Project1_u_WFD, and select Design Table.
  4. Select the column named modStateId, and enter the following formula in the formula property.
    ([tp_State])
    
  5. Click Yes to override the warning of deleting relationships.
  6. Click the Save icon to apply the design change.
  7. Confirm the operation by clicking Yes in the Save dialog box.

Confirming Enforcement of Business Rules

Now, you have completed adding workflow to the interactive list. You can confirm this after navigating to the created list by the following:

  1. Select New Document, and type Enforcement6 in the Word document that is launched. From the File menu in Word, select Save to open the Save As dialog box. Select Save in the Save As dialog box to open the Web File Properties dialog box. Click OK in the Web File Properties dialog box to return to Word. From the File menu in Word, select Exit. Confirm failure in creating a record in the interactive list, because the state is not valid.
  2. Select New Document, and type Enforcement7 in the Word document that is launched. From the File menu in Word, select Save to open the Save As dialog box. Select Save in the Save As dialog box to open the Web File Properties dialog box. Change the state to A_Draft, and save by clicking OK in the Web File Properties dialog box to return to Word. From the File menu in Word, select Exit. Confirm success in creating a record in the interactive list.
  3. Select Enforcement7 to open the list item. From the File menu in the browser, select Edit with Microsoft Word. From the File menu in Word, select Properties to open the Web File Properties dialog box. Change the state to E_Approved, and close the Web File Properties dialog box by clicking OK to return to Word. From the File menu in Word, select Save. From the File menu in Word, select Exit. Click Back in the browser to return to the created list. Confirm failure in updating the record, because this is not a valid state transition.
  4. Select Enforcement7 to open the list item. From the File menu in the browser, select Edit with Microsoft Word. From the File menu in Word, select Properties to open the Web File Properties dialog box. Change the state to B_Reviewer1, and close the Web File Properties dialog box by clicking OK to return to Word. From the File menu in Word, select Save. From the File menu in Word, select Exit. Click Back in the browser to return to the created list. Confirm failure in updating the record; this is not a valid state transition, because no reviewer is specified as reviewer1.
  5. Select Enforcement7 to open the list item. From the File menu in the browser, select Edit with Microsoft Word. From the File menu in Word, select Properties to open the Web File Properties dialog box. Change the state to B_Reviewer1, change reviewer1 to yourself, and close the Web File Properties dialog box by clicking OK to return to Word. From the File menu in Word, select Save. From the File menu in Word, select Exit. Click Back in the browser to return to the created list. Confirm success in updating the record, because this is a valid state transition.
  6. Click the Edit Document Properties icon next to Enforcement7 to open the list item. Change the state to E_Approved, and save by clicking Save and Close. Confirm success in updating the record, because this is a valid state transition. There is a transition in the workflow that allows state transition from B_Reviewer1 to E_Approved if a reviewer is not specified for reviewer2.

Wf4list.wfs—List

Creating an Image Registry

The definition of an image registry here is a list of images that users commonly use. An image registry can be created easily as an interactive list.

  1. Navigate to your SharePoint team Web site.
  2. Select Lists on the top of the page, to navigate to the Lists page.
  3. Select New List to navigate to the Create page.
  4. Select Custom List to navigate to the New List page.
    • Enter Image Registry in the Name field.
    • Enter List of images in the Description field.
    • Click Yes to show this list on the Quick Launch bar.
  5. Select Create to navigate to the Image Registry page.
  6. Select Modify settings and columns to navigate to the Customize page.
  7. Select Add a new column in the Columns section of the Customize page to navigate to the Add Column page.
    • Enter Image in the Column name field.
    • Select Hyperlink or Picture as the type of information.
    • Select Picture for Format URL as drop-down list box.
    • Click OK to navigate back to the Customize page.
  8. Select Go back to "Image Registry" to return to the Image Registry page.

Now that the image registry has been created, follow these steps to add images that will be used.

  1. Navigate to your SharePoint team Web site.
  2. Select Lists on the top of the page, to navigate to the Lists page.
  3. Select Image Registry to navigate to the previously created list.
  4. Select New Item to navigate to the New Item page.
    • Enter a title for the image in the Title field.
    • Enter a URL to the image in the Image field.
    • Click Save and Close to navigate back to the Image Registry page.
  5. Repeat step 4 for all images. Users will be able to choose how their approval should be visualized from this list of images. Scanned images of signatures or endorsement stamps should be added here.
    Note   Images must be located where HTTP access is possible to be added to the image registry.

Creating an Interactive List

Interactive lists can be created with a browser.

  1. Navigate to your SharePoint team Web site.
  2. Select Lists on the top of the page to navigate to the Lists page.
  3. Select New List to navigate to the Create page.
  4. Select Custom List to navigate to the New List page.
    • Enter WFL2 in the Name field.
    • Enter List with Workflow in the Description field.
    • Click Yes to show this list on the Quick Launch bar.
  5. Click Create.

Adding Workflow

Existing workflow can be added to the interactive list from the Workflow Designer for SQL Server.

  1. From the Start menu, select Programs, Microsoft Office XP Developer, and then select Microsoft Development Environment.
  2. From the File menu, select Recent Projects, and then select SharePoint.sln.
  3. Right-click Workflow Processes in the Solution Explorer, and select Add Existing Workflow to open the Specify existing workflow file dialog box.
    • Browse to wf4list.wfs in the sample, and select it.
  4. Select Open to launch the Add Workflow Process dialog box.
    • Select ows_Project1_u_WFL2 in the Main or detail user table drop-down list box.
  5. Click OK to open the workflow process for editing.
  6. Select ows_Project1_u_WFL2Workflow in the Solution Explorer, and make sure the EnableWorkflow property is True in the Properties Window. If it is False, select True from the drop-down list box.
  7. Select ows_Project1_u_WFL2Workflow in the Solution Explorer, and make sure the DeletedRowsAvailable property is True in the Properties Window. If it is False, select True from the drop-down list box.
  8. From the File menu, select Save All.
  9. From the File menu, select Exit.

Customizing SharePoint Team Web Sites

The customization features built-in to SharePoint team Web sites are used to create user interface elements through which users interact with workflow. Copy wf4list.xls before proceeding. This Excel file will be imported into the SharePoint team Web site as a list of states for the workflow created earlier.

  1. Navigate to your SharePoint team Web site.
  2. Select Lists on the top of the page, to navigate to the Lists page.
  3. Select New List to navigate to the Create page.
  4. Select Import Spreadsheet to navigate to the New List page.
    • Enter State for WFL2 in the Name field.
    • Enter Lookup list for states in the Workflow in the Description field.
    • Browse to wf4list.xls in the sample by clicking Browse, and select the Excel file in the Choose File dialog box.
    • Select Open to navigate back to the New List page.
    • Select No to not show this list on the Quick Launch bar.
  5. Select Import to have Excel launch. Select the list in the Excel file as a range.
  6. Select Import in the Import to SharePoint List dialog box in Excel.
  7. Confirm that the whole list was imported into the State for WFL2 list.
  8. Select Lists on the top of the page to navigate to the Lists page.
  9. Select WFL2 to navigate to the previously created list.
  10. Select Modify settings and columns to navigate to the Customize page.
  11. Select Add a new column in the Columns section of the Customize page to navigate to the Add Column page.
    • Enter State in the Column name field.
    • Select Lookup as the type of information.
    • Select State for WFL2 in the Get information from drop-down list box.
    • Click OK to navigate back to the Customize page.
  12. Select Add a new column in the Columns section of the Customize page to navigate to the Add Column page.
    • Enter Reviewer1 in the Column name field.
    • Select Lookup as the type of information.
    • Accept default User Information for Get information from drop-down list box.
    • Select Add to default view.
    • Click OK to navigate back to the Customize page.
  13. Select Add a new column in the Columns section of the Customize page to navigate to the Add Column page.
    • Enter Select1 in the Column name field.
    • Select Lookup as the type of information.
    • Select Image Registry for the Get information from drop-down list box.
    • Select Add to default view.
    • Click OK to navigate back to the Customize page.
  14. Select Add a new column in the Columns section of the Customize page to navigate to the Add Column page.
    • Enter Image1 in the Column name field.
    • Select Hyperlink or Picture as the type of information.
    • Select Picture for the Format URL as drop-down list box.
    • Click OK to navigate back to the Customize page.
  15. Select Add a new column in the Columns section of the Customize page to navigate to the Add Column page.
    • Enter Reviewer2 in the Column name field.
    • Select Lookup as the type of information.
    • Accept default User Information for Get information from drop-down list box.
    • Select Add to default view.
    • Click OK to navigate back to the Customize page.
  16. Select Add a new column in the Columns section of the Customize page to navigate to the Add Column page.
    • Enter Select2 in the Column name field.
    • Select Lookup as the type of information.
    • Select Image Registry for the Get information from drop-down list box.
    • Select Add to default view.
    • Click OK to navigate back to the Customize page.
  17. Select Add a new column in the Columns section of the Customize page to navigate to the Add Column page.
    • Enter Image2 in the Column name field.
    • Select Hyperlink or Picture as the type of information.
    • Select Picture for the Format URL as drop down-list box.
    • Click OK to navigate back to the Customize page.
  18. Select Add a new column in the Columns section of the Customize page to navigate to the Add Column page.
    • Enter Reviewer3 in the Column name field.
    • Select Lookup as the type of information.
    • Accept default User Information for Get information from drop-down list box.
    • Select Add to default view.
    • Click OK to navigate back to the Customize page.
  19. Select Add a new column in the Columns section of the Customize page to navigate to the Add Column page.
    • Enter Select3 in the Column name field.
    • Select Lookup as the type of information.
    • Select Image Registry for the Get information from drop-down list box.
    • Select Add to default view.
    • Click OK to navigate back to the Customize page.
  20. Select Add a new column in the Columns section of the Customize page to navigate to the Add Column page.
    • Select Image3 in the Column name field.
    • Select Hyperlink or Picture as the type of information.
    • Select Picture for the Format URL as drop-down list box.
    • Click OK to navigate back to the Customize page.
    • Select Go back to "WFL2" to return to the WFL2 page.

Changing the Table Design

A minor change in the table design is required to hook up the user interface elements, created using the built-in customization features of SharePoint Team Services, to the workflow.

  1. From the Start menu, select Programs, Microsoft SQL Server, and then select Enterprise Manager.
  2. Expand the following nodes: Console Root | Microsoft SQL Server | SQL Server Group | computer | Databases | computer _LM_W3SVC_1_Collab | Tables.
  3. Right-click ows_Project1_u_WFL2, and select Design Table.
  4. Select the column named modStateId, and enter the following formula in the formula property.
    ([tp_State])
    
  5. Click Yes to override the warning of deleting relationships.
  6. Click the Save icon to apply the design change.
  7. Confirm the operation by clicking Yes in the Save dialog box.

Modifying Constants Used to Generate URLs

Notifications sent in this sample use a constant to generate the URL to list items. The constant can be edited by the following steps:

  1. From the Start menu, select Programs, Microsoft Office XP Developer, and then select Microsoft Development Environment.
  2. From the File menu, select Recent Projects, and then select SharePoint.sln.
  3. Double click ows_Project1_u_WFL2Workflow in the Solution Explorer to open the workflow process.
  4. From the View menu, select Code.
  5. Edit the URL being defined as constant CDispFormURL by replacing computer with your computer name.
    Const CDispFormURL = http://computer/Lists/WFL2/DispForm.htm
    

Confirming Enforcement of Business Rules

Now, you have completed adding workflow to the interactive list. You can confirm this by doing any of the following after navigating to the created list:

  1. Select New Item, and create an item with the title Enforcement8 and the state (None) by clicking Save and Close. Confirm failure in creating a record, because the state is not valid.
  2. Select New Item, and create an item with the title Enforcement9 and the state A_Draft by clicking Save and Close. Confirm success in creating a record.
  3. Select Enforcement9 to open the list item. Select Edit Item to make the list item editable, change the state to E_Approved, and save by clicking Save and Close. Confirm failure in updating the record, because this is not a valid state transition.
  4. Select Enforcement9 to open the list item. Select Edit Item to make the list item editable, change the state to B_Reviewer1, and save by clicking Save and Close. Confirm failure in updating the record; this is not a valid state transition, because no reviewer is specified as reviewer1.
  5. Select Enforcement9 to open the list item. Select Edit Item to make the list item editable, change the state to B_Reviewer1 and reviewer1 to yourself, and save by clicking Save and Close. Confirm success in updating the record, because this is a valid state transition.
  6. Select Enforcement9 to open the list item. Select Edit Item to make the list item editable, change the state to C_Reviewer2, change select1 to some image in the image registry, change reviewer2 to some user (user A), and save by clicking Save and Close. Confirm success in updating the record, because this is a valid state transition and the selected image is visible in the list.
  7. Logon as user A, and navigate to the created list. Select Enforcement9 to open the list item. Select Edit Item to make the list item editable, change select1 to some other image in the image registry, and save by clicking Save and Close. Confirm failure in changing the image, because this is not a valid update.
  8. Logon as user A, and navigate to the created list. Select Enforcement9 to open the list item. Select Edit Item to make the list item editable, change the state to E_Approved, and save by clicking Save and Close. Confirm success in updating the record, because this is a valid update.
Show:
© 2014 Microsoft