Workflow using custom InfoPath Task Form can't access Extended Properties from ItemMetaData.xml
-
Friday, April 13, 2012 11:01 PM
I have a custom task form working in InfoPath and am able to set values using the ItemMetaData.xml file. However trying to access Values from the AfterProperties of the task is returning an empty string.
So my steps are:
I add the extended property when creating the task:
private void CreateApprovalTask_MethodInvoking(object sender, EventArgs e) { approvalTaskId = Guid.NewGuid(); approvalTaskProperties.TaskType = 0; approvalTaskProperties.SendEmailNotification = true; approvalTaskProperties.ExtendedProperties.Add("Technical_Input", "Test Value");
Add the property to the ItemMetadata.xml:
<?xml version="1.0" encoding="utf-8"?> <z:row xmlns:z="#RowsetSchema" ows_Technical_Input="" />
Test it in the Form, it works just fine:
But when I debug and access the value from the Extended After Property, i'm getting an empty string instead of the user's input:
private void onTaskChanged1_Invoked(object sender, ExternalDataEventArgs e) { string TechnicalInput = this.approvalTaskAfterProperties.ExtendedProperties["Technical_Input"].ToString();Has anyone ever experienced this?
- Moved by Emir LiuMicrosoft Contingent Staff, Moderator Monday, April 16, 2012 8:35 AM SharePoint 2010 programming problem (From:SharePoint 2010 - Using SharePoint Designer, Infopath, and other customization)
All Replies
-
Tuesday, April 17, 2012 2:47 AMModerator
Hi Omar,
For the ExtendedProperties, the hash table contains a GUID and a value, use the name of the field will not work, please try to get the ID of the field first, then get the value using ExtentedProperties[fieldID].
System.Guid fieldID = workflowProperties.TaskList.Fields[“fieldname”].Id;
Thanks,
QiaoQiao Wei
TechNet Community Support
-
Tuesday, April 17, 2012 1:20 PM
Thanks Qiao. That didn't seem to work in the OnTaskChanging Event.
I Eventually found the problem: SharePoint wouldn't write back to the ItemMetaData Fields unless they were in the Root of the InfoPath Form. Fields in Folders don't seem to bind.
- Marked As Answer by Qiao WeiMicrosoft Contingent Staff, Moderator Thursday, April 26, 2012 9:38 AM
-
Thursday, April 26, 2012 9:42 PMThanks Omar. I was having the same issue and this solved it.
C#, Sharepoint

