Infopath + workflow + Moss

Source: Internet
Author: User

In Moss 2007, infopath 2007 and workflow foundation can be used to efficiently create very powerful workflow applications. This is because the content in the SDK is not smooth and it is difficult to read. So I want to share with you my little experience and hope to avoid detours, and then combine the SDK, ECM starter kits and WSS workflow starterkits to quickly master this great feature.

1. I want to create a workflow project for moss.

Download WSS workflow starterkits. After installation, there will be a "Sharepoint Server" group with two project templates: SharePoint sequential workflow library and SharePoint state machine workflow library. Projects created using these two templates are convenient for the development and deployment of workflow.

  • ProjectMicrosoft. Office. workflow. Tasks. dll, Microsoft. Sharepoint. dll, and Microsoft. Sharepoint. workflowactions. dllAll are in the c: \ Program Files \ common files \ microsoft shared \ Web Server Extensions \ 12 \ ISAPI \ directory of the machine with moss 2007 installed. During development, remember to register Microsoft. Sharepoint. workflowactions. dll in the vs2005 toolbox to drag the workflow control that is unique to Moss from the toolbox.
  • Feature. xml: In Moss, workflow exists as the feature of moss. It is associated with a specific list or library and created for instance operation. Because the feature. xml file registers the generated project DLL file to the moss as the description file of feature during installation and deployment. It was blank when it was just opened, just a few prompts, as prompted to insert feature snippets, there is a piece of XML code inserted. You can use the create guid in vs2005 menu tools to create a new guid. There is a <elementmanifest location = "workflow. xml"/> node in the middle to associate the workflow XML description file.
  • Workflow. xml: Workflow description file. There is a workflow name (the name is displayed in the workflow list when the workflow associated with a specific list or document library is added); GUID (also generated by the create guid ); codebesideclass and codebesideassembly correspond to the full name of the workflow class and the full name of the Assembly (for example, if a project is signed, publicktoken must be specified here, and install. in bat, gacutil is partially commented out); tasklistcontenttypeid is the contenttype ID of the task list used by the workflow. The default value is the contenttypeid of workflow tasks, which generally does not need to be modified; associationurl, instantiationurl, and modificationurl do not need to be changed either. The default creation is the page for displaying infopath. associationurl is used to associate workflow, list, or document library, and Page for setting Workflow running parameters; instantiationurl is the initialization page that is displayed to users when workflow is manually enabled. Nodes ending with _ formurn, such as association_formurn and instantiation_formurn, store their corresponding infopath form IDS (this ID can be used when infopath form is designed, open the "file-> Properties" window to see the ID of the infopath form ). Taskform is explained below.
  • Install. bat: Install and deploy the workflow batch file. Comment out or reverse comment the command line according to the actual situation, and configure the moss address at the same time.
  • Workflow1.cs: WorkFlow Design and code.

2. My infopath form template cannot be normally published, or the status is "installing" instead of "ready" after the release ".

Check the following steps. Generally, the failure to publish normally may be caused by the following reasons.

  1. First, check whether the form template is compatible with the browser. In the design form template status, open the infopath menu "tools --> check the design scheme", and then click "Change compatibility Settings" in the task pane on the right to bring up the form option, in the "browser compatibility" group, "design a form template that can be opened in the browser or infopath", and then check.
  2. If form publishing is used for web access, you can also open "form options" and change "Security Level" to "Domain" level in "security and trust.
  3. It is recommended that all forms have never been published. Judgment basis, put. copy the xsn form template file to other places, right-click "design" and open it. If a warning box appears, the system prompts "This form has been published to a position, but it was stored or moved to another location. If the form based on this template works properly, release the form again. "This indicates that the form has been published, otherwise it has not been published. For a form template that has not been released, the system prompts "publish" or "save" each time you save the form template ".
  4. If the infopath form has a back C # Or VB. NET code, that is, it is accidentally opened using vsta, the post must be reviewed by the Administrator, and the form cannot be normally published. You can click "Delete Code" in "programming" in the "form options" window.
  5. Infopath 2007 is a Chinese version, but an exception occurs when it is released to the English version of moss. In the "form options" window, select "English (US)" as the form language in "Browser.

3. I set workflow in the moss list to automatically start when a record is added, and create a task for the approver. The task uses the infopath form defined by myself, however, the infopath task form contains several fields to read the Field Values in record a for display.

The essence of this problem is to pass the field value in a specific listitem to the task form (this form is an infopath form), and then display it through the task form. The header has three subquestions: how to obtain the listitem related to the current workflow, how to pass the value to the task form, and how to render the task form at the end.

  1. How to get the listitem related to the current workflow: Get the current splistitem through spworkflowactivationproperties. item.
  2. How to pass the form to a task. See how to: Access workflow task form data. For example, taskproperties. extendedproperties ["applyno"] = This. applyno ;.
  3. How to render the task form at the end. View the 4th, 5, and 6 points of creating the workflow task edit form. When binding the ows _ field, the "Main" data source without the ows _ field is selected by default. You must select the "itemmetadata (Auxiliary)" data source to see the ows _ field.

For more information, see the typical helloworld example in ecmstarterkits. In combination with the notes above.

4. I am now in workflow. A task form is configured in XML (with a node like <task0_formurn> urn: Schemas-Microsoft-com: Office: infopath: reviewtaskform:-myXSD-2005-11-22T23-52-35 </task0_formurn> ), this task form is used by my first task, but I still have step 2 and Step 3. Each step creates a task, each of my tasks must correspond to different task forms to collect user input data in each stage to operate the workflow. How to add the second task form?

According to the SDK Windows Task form, the first step of adding the second task form is to configure the ID (URN) of the infopath form template used in step 1. Add a node like this under the <task0_formurn> node: <taskaskformurn> urn: Schemas-Microsoft-com: Office: infopath: multistage-initiation:-myXSD-2006-04-28T22-44-03 </task1_formurn>.

The real core problem arises. How can we associate the 2nd task forms <taskdetailformurn> with the 2nd tasks allocated in the actual workflow? The key is the spworkflowtaskproperties. tasktype attribute. Tasktype = 0 indicates that this is the first task. Please use the first task form. tasktype = 1 indicates that this is the second task. Please use the second task form. That's simple. :)

You can open the multistage example in ECM starterkits. This example is a practical example and must be studied. Open workflowtask. CS in the example and find the gettaskcreationproperties () method. Modify as follows:

Public spworkflowtaskproperties gettaskcreationproperties (Int tasktype)
{
Spworkflowtaskproperties properties = new spworkflowtaskproperties ();
Properties. assignedto = This. Fig [0]. accountid;
Properties. Title = This. tasktitle;
Properties. Description = This. taskinstructions;
Properties. sendemailnotification = true;
Properties. tasktype =Tasktype;
Properties. duedate = (datetime) This. duedate;

Return properties;
}

Then open the workflow1.cs code and find this line of code activity. taskcreationproperties = This. activetask. gettaskcreationproperties (); changed:

Activity. taskcreationproperties = This. activetask. gettaskcreationproperties (this. completedstages );

So far, this multistage example is more intelligent. In addition to adding a workflow step, you can also easily control the infopath form used by each step task, instead of using the same form.

5. come here first. Finally, we recommend several classic articles:

  • SharePoint 2007 and Windows Workflow Foundation: Integrating divergent worlds
  • Developing Workflow in vs (part 1 ~ Part 7)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.