Quick Start (Base64): Retrieving form data from tasks using the web service API

The following C# code example retrieves form data from a task with the identifier value of 304. Form data is written to an XML file named FormData.xml located at C:\Adobe.

using System; 
using System.Collections; 
using System.ComponentModel; 
using System.Data; 
using System.IO ; 
 
namespace RetrieveFormData 
{ 
    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"); 
 
                //Retrieve the form associated with the task 
                FormInstance formInstance = tmService.getFormInstanceForTask(316,true,316,true,true,true); 
                BLOB formData = formInstance.document ;  
                 
                //Populate the byte array with form data located in the BLOB object 
                byte[] outByteArray = formData.binaryData; 
     
                //Save the form data as formData.xml 
                string FILE_NAME = "C:\\Adobe\formData.xml"; 
                FileStream fs2 = new FileStream(FILE_NAME, FileMode.OpenOrCreate); 
                BinaryWriter w = new BinaryWriter(fs2); 
                w.Write(outByteArray); 
                w.Close(); 
                fs2.Close(); 
 
            } 
            catch (Exception ee) 
            { 
                Console.WriteLine(ee.Message); 
            } 
        } 
    } 
}

// Ethnio survey code removed