To create a SharePoint sequential workflow project
First, create a sequential workflow project in Visual Studio. Sequential workflows are a series of steps that are performed sequentially until the last activity completes. In this procedure, you will create a sequential workflow that applies to the Shared Documents list in SharePoint. The wizard of this workflow allows you to associate this workflow with a site or list definition and to determine when the workflow starts.
1. Display the New Project dialog box by pointing to New on the File menu and clicking New Project.
2. Expand the SharePoint node under Visual C #, and then click 2010.
3. In the Templates pane, select Sequential Workflow.
4. In the Name box, type a name, and then click OK.
This displays the SharePoint Customization wizard.
5. Which local Web site do you want to use for debugging? Page, click Next to accept the default Web site.
This step also sets the trust level for the solution to be the farm solution (the only available option for the workflow project).
6. On the Specify the workflow name for debugging page, accept the default name ("*-Workflow1"). Retains the default workflow template type value (List workflow). Click "Next".
7. Do you want Visual Studio to automatically associate a workflow in a debugging session? Page, clear the box that automatically associates the workflow template (If this box is selected).
With this step, you can manually associate the workflow with the Shared Documents list that displays the associated form later.
8. Click Finish.
Add an associated form to a workflow
Next, create a. ASPX Association form, which is displayed when a SharePoint administrator associates a workflow with a document library or list for the first time.
1. Click the Workflow1 node in Solution Explorer.
2. Click Add New Item on the Project menu to display the Add New Item dialog box.
3. In the tree view of the dialog box, expand Visual C #, expand the SharePoint node, and then click 2010.
4. In the list of templates, select the Workflow association form.
5. In the Name text box, type workflow1associationform.aspx.
6. Click the Add button to add the form to your project.
Design and encode an associated form
In this procedure, you introduce functionality by adding controls and code to the associated form.
1. In the associated form (workflow1associationform.aspx), locate the asp:content element with id= "Main".
2. Immediately after the first line in this content element, add the following code to create a label and text box that prompts for a fee approval limit (AUTOAPPROVELIMIT):
<asp:label id= "Lblautoapprovelimit" text= "quota for submission of approvals:" runat= "Server"/>
<asp:textbox id= "Autoapprovelimit" runat= "Server"/>
3. Expand the Workflow1associationform.aspx file in Solution Explorer to display its subordinate files.
4. Right-click the workflow1associationform.aspx file and select "View Code".
5. Replace the Getassociationdata method with the following:
private String Getassociationdata ()
{
return this. Autoapprovelimit.text;
}
To add a startup form to a workflow
Next, create the startup form that appears when the user runs a workflow on a document library or list.
Create a startup form
1. Click the Workflow1 node in Solution Explorer.
2. Click Add New Item on the Project menu to display the Add New Item dialog box.
3. In the tree view of the dialog box, expand Visual C #, expand the SharePoint node, and then click 2010.
4. In the list of templates, select the Workflow startup form.
5. In the Name text box, type workflow1initiationform.aspx.
6. Click the Add button to add the form to your project.
Design a startup form and encode it