Quick Start (Base64): Modifying form data using the web service API

The following C# code example updates a form with data that is located in the FormData.xml file.

using System; 
using System.Collections; 
using System.ComponentModel; 
using System.Data; 
using System.IO ; 
 
namespace ModifyFormData 
{ 
    class Class1 
    { 
        [STAThread] 
        static void Main(string[] args) 
        { 
            try 
            { 
                //Create a TaskManagerServiceService object  
                //and set authentication values 
                TaskManagerServiceService tmService = new TaskManagerServiceService();  
                tmService.Credentials = new System.Net.NetworkCredential("tblue", "password"); 
 
                //Specify form data that is used to update the form 
                string path = "C:\\Adobe\FormData.xml"; 
                FileStream fs = new FileStream(path, FileMode.Open); 
 
                //Create a BLOB object to store form data 
                  BLOB inDoc = new BLOB(); 
                 
                //Get the length of the file stream 
                int len = (int)fs.Length; 
                byte[] formArray=new byte[len]; 
     
                //Populate the byte array with the contents of the FileStream object 
                fs.Read(formArray, 0, len); 
                inDoc.binaryData = formArray;  
                      
                //Retrieve the form associated with the task 
                FormInstance formInstance = tmService.getFormInstanceForTask( 
                    4, 
                    true, 
                    4, 
                    true, 
                    true, 
                    true); 
                formInstance.XFAData=formArray; 
                formInstance.document=inDoc; 
                                 
                //Save the task with the updated form data 
                SaveTaskResult result = tmService.saveFormData(4,true,formInstance); 
                Console.WriteLine("The task identifier is "+result.taskId); 
        } 
            catch (Exception ee) 
            { 
                Console.WriteLine(ee.Message); 
            } 
        } 
    } 
}

// Ethnio survey code removed