How to: Access Contact Data in Workflow Edit Task Forms in SharePoint Server 2010 (ECM)
Applies to: SharePoint Server 2010
Microsoft SharePoint Foundation 2010 sends the data from workflow task forms to the workflow as a hash table, in which each key-value pair is indexed by the name of the field control on the form. For example, suppose the Contact Selector control on your form is named myUsers. In this case, you access your contact data in the hash table by specifying myUsers as the index.
This hash table can be accessed by using the ExtendedProperties property of the SPWorkflowTaskProperties object. The SPWorkflowTaskProperties object can be accessed by using the TaskProperties property of the workflow task activity for which the task from is displayed, such as CreateTask, UpdateTask, CompleteTask, or DeleteTask.
For more information about accessing workflow task data, see How to: Access Workflow Task Form Data in a Workflow in SharePoint Server 2010 (ECM).
For more information about workflow task forms, see Workflow Task Forms in SharePoint Server 2010 (ECM).
For more information about specific task activities, see the Microsoft SharePoint 2010 SDK.
Use the Contact.ToContacts method to deserialize the hash table contact data into an array of Contact objects.
Contacts[] contacts = Contact.ToContacts(taskProperties.ExtendedProperties["myUsers"].ToString());
Dim contacts() As Contacts = Contact.ToContacts(taskProperties.ExtendedProperties("myUsers").ToString())
In this example, the name of the field bound to the Contact Selector control is "myUsers". Therefore, "myUsers" is also the index of the name-value pair in the hash table that contains the contact data.
Use the various properties of the Contact objects to access the contact data.
How to: Add the Contact Selector to InfoPath (ECM)
How to: Configure a Contact Selector Control on Your InfoPath Workflow Form (ECM)
How to: Access Workflow Task Form Data in a Workflow in SharePoint Server 2010 (ECM)
How to: Design a Workflow Task Form to Use Task Data in SharePoint Server 2010 (ECM)
InfoPath Forms for Workflows (ECM)
Using the Contact Selector Control in InfoPath Workflow Forms (ECM)