• [MSDN]How to: Design a Workflow Task Form to Use Task Data


    Published: May 2010

    When Microsoft SharePoint Server 2010 displays a custom Microsoft Office InfoPath 2007 form for a workflow task, SharePoint Server 2010 passes the task data to the form as XML. For your InfoPath task form to be able to understand and parse the task data XML, you must add the task schema to the form as a secondary data source.

    To do this, you must create a file called ItemMetadata.xml that represents the task schema, and then add that file to your form as a secondary data source. Then you can data-bind your form controls to specific elements of the task schema XML.

    NoteNote

    SharePoint Server 2010 always sends the task data XML to the task edit form on load. Because of this, you must always add an ItemMetadata.xml file to your form as a secondary data source, even if you do not plan on using any of the task data. Otherwise, SharePoint Server 2010 generates an error.

    To create a schema file for a workflow task schema

    1. In the text editor of your choice, create a file named ItemMetadata.xml.

    NoteNote

    The file name ItemMetadata.xml is case-sensitive.

    1. Add the following element to the file:

      <z:row xmlns:z="#RowsetSchema"/>
      
    2. In the file, define each task property that you want to use in your form. To do this, add an attribute composed of the prefix ows and the name of the task field. Set the attribute equal to an empty string.

      For example, suppose there are two task fields you want to use in your form: instructions, and comments. Your finished ItemMetadata.xml file would contain the following:

      <z:row xmlns:z="#RowsetSchema" 
        ows_instructions="" 
        ows_comments="" />
      

    NoteNote

    You must define an ows attribute for each task field in your form from which you want to retrieve data, even standard task fields that are included on all tasks, such as Title or Assigned To.

    You do not need to define attributes for any task fields in your form from which you do not want to retrieve data.

    1. Save the finished ItemMetadata.xml file to your hard disk.

    To add the task schema to a workflow form as a secondary data source

    1. In Microsoft InfoPath 2010, under Design Tasks, select Data Source, and then click Manage Data Connection.

    2. On the Data Connections dialog box, click Add.

    3. In the Data Connection Wizard, select Add a new connection to, and Receive data. Click Next.

    4. Select XML Document. Browse to the location where you saved your ItemMetadata.xml file, select it, and then click Next.

    5. Select Include the data as a resource file in the form template, and then click OK.

    6. Enter ItemMetadata as the data connection name, and make sure Automatically retrieve data when form is opened is selected. ClickFinish.

      After you include the ItemMetadata.xml file as a resource file in the form template, you no longer need the ItemMetadata.xml file itself. You do not need to include the file in your workflow solution.

    To data-bind your form controls to the task schema

    1. In InfoPath 2010, double-click the control on your form that you want to data-bind.

    2. In the Propertiesdialog box, on the Datatab, under Default Value, click the formula button.

    3. In the Insert Formula dialog box, click Insert a Field or Group.

    4. In the Select a Field or Groupdialog box, select your ItemMetadata data connection, and then select the field in that data connection to which you want to data-bind your control. Click OK.

    5. In the Insert Formuladialog box, click OK. In the Properties dialog box, click OK.

      For more information about data-binding form controls to data sources, see the InfoPath 2010 help.

  • 相关阅读:
    获取指定目录下的所有文件
    char码值对应列表大全
    烂记性不如好笔头㈠㈢㈥
    SQL Server中的Image数据类型的操作
    企业信息化与标准化的纠结(二)
    企业信息化的前世今生
    企业信息化与标准化的纠结(一)
    关于 EOM(Enterprise Operating Model)企业经营模型(1) 转自n216
    《优秀程序员应该具备哪些素质》(ZT)
    谈谈MIS建设与职能架构的问题
  • 原文地址:https://www.cnblogs.com/frankzye/p/1930348.html
Copyright © 2020-2023  润新知