Workflow using custom InfoPath Task Form can't access Extended Properties from ItemMetaData.xml

Answered Workflow using custom InfoPath Task Form can't access Extended Properties from ItemMetaData.xml

  • 2012年4月13日 23:01
     
      包含代码

    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?

全部回复

  • 2012年4月17日 2:47
    版主
     
     

    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,
    Qiao


    Qiao Wei

    TechNet Community Support

  • 2012年4月17日 13:20
     
     已答复

    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.

  • 2012年4月26日 21:42
     
     
    Thanks Omar. I was having the same issue and this solved it.

    C#, Sharepoint