Chinaunix首页 | 论坛 | 博客
  • 博客访问: 8236883
  • 博文数量: 444
  • 博客积分: 10593
  • 博客等级: 上将
  • 技术积分: 3852
  • 用 户 组: 普通用户
  • 注册时间: 2006-05-09 15:26
文章分类

全部博文(444)

文章存档

2014年(1)

2013年(10)

2012年(18)

2011年(35)

2010年(125)

2009年(108)

2008年(52)

2007年(72)

2006年(23)

分类: 系统运维

2010-05-29 16:17:13

When you create a workflow task, its property data comes from an object, which you can access through the property of the activity. This object contains information that is standard for every workflow task, as well as any custom properties contained in the task schema. By initializing the object variable you specify for the property, you can use the task data passed to the workflow.

NoteNote

The object you access through the property simply contains initialization information about the newly created task; it is not dynamically bound to the task itself in any way. Changes made to the task are not reflected in the data stored in this object.

The object contains a standard set of properties for every workflow task in SharePoint Foundation, such including , , , and .

In addition, the object also contains a hash table, represented by the property, to store custom task properties. You can access a specific custom property by passing the property name as an index for the property.

Microsoft SharePoint Server 2010 names each custom data value in the hash table after the task field that contains the data. For example, if you have a text field in your workflow task named comments, the index name of that field's data in the property hash table is comments as well.

NoteNote

The hash table is populated with both standard fields and custom fields. However, the standard workflow task type fields are represented with GUID indexes, rather than with their names, to prevent possible name collisions with custom fields of the same name. We recommend you access standard workflow task fields through their respective properties, rather than through the hash table.

In general, bind the property of each task-related activity to the object variable you defined for the property of the activity that created that specific task. This object variable is used as a conduit to pass data into the task.

For more information about setting activity properties, see the Windows Workflow Foundation SDK.

Data from a Microsoft InfoPath 2010 workflow task form is not passed directly into the workflow, as it is for workflow association or initiation forms. Rather, the task form changes the fields corresponding to the form schema in the task item directly; these changes are passed into the workflow only if the workflow is waiting for an event. To receive data from an InfoPath form, you need an event receiver activity for the corresponding event, such as . The object bound to the property of the object stores the fields in the task that have changed (and only those that have changed). By default, an InfoPath form will alter the task using fields that match the form's schema.

To access workflow task form data in a workflow

  • If the data is from a standard workflow task field, access it by using the applicable property of the object.

    For example, suppose you set the property of the activity for your workflow task to an object variable named wfTaskProps. To access the property, you refer to it in your code as follows:

    wfTaskProps.AssignedTo.ToString()
    

    If the data is from a custom field, access it by using the field name as the index value for the property of the object.

    For example, to access a custom property named comments, refer to it in your code as follows:

    wfTaskProps.ExtendedProperties("comments").ToString()
    
阅读(1098) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~