Quick Start (MTOM): Add content to Content Services using the web service API (Deprecated)

The following C# code example adds a PDF file named MortgageForm.pdf to a folder named /Company Home/Test Directory. The creator and description attributes are set. The identification value of the new content is written to the console. (See Adding Content to Content Services (deprecated).)

    * Ensure that you create a .NET project that uses  
    * MS Visual Studio 2008 and version 3.5 of the .NET 
    * framework. This is required to invoke a  
    * LiveCycle service using MTOM. 
    * For information, see "Invoking LiveCycle using MTOM" in Programming with LiveCycle   
using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text; 
using System.ServiceModel; 
using System.IO; 
using ConsoleApplication1.ServiceReference1; 
namespace AddContent 
       class Program 
           static void Main(string[] args) 
                   //Specify the name of the store and node 
                   String storeName = "SpacesStore"; 
                   String nodeName = "/Company Home/Test Directory"; 
                   //Create a DocumentManagementServiceClient object 
                   DocumentManagementServiceClient docManagement = new DocumentManagementServiceClient(); 
                   docManagement.Endpoint.Address = new System.ServiceModel.EndpointAddress("http://hiro-xp:8080/soap/services/DocumentManagementService?blob=mtom"); 
                   //Enable BASIC HTTP authentication 
                   BasicHttpBinding b = (BasicHttpBinding)docManagement.Endpoint.Binding; 
                   b.MessageEncoding = WSMessageEncoding.Mtom; 
                   docManagement.ClientCredentials.UserName.UserName = "administrator"; 
                   docManagement.ClientCredentials.UserName.Password = "password"; 
                   b.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic; 
                   b.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly; 
                   //Reference the PDF file to upload to Content Services 
                   FileStream fs = new FileStream("C:\\Adobe\MortgageForm.pdf", FileMode.Open); 
                   //Create a BLOB object 
                   BLOB content = new BLOB(); 
                   //Get the length of the file stream  
                   int len = (int)fs.Length; 
                   byte[] ByteArray = new byte[len]; 
                   //Populate the byte array with the contents of the FileStream object 
                   fs.Read(ByteArray, 0, len); 
                   content.MTOM = ByteArray; 
                   String browseLink; 
                   CRCResult result;  
                   //Set content attributes 
                   ConsoleApplication1.ServiceReference1.MyMapOf_xsd_string_To_xsd_anyType inputs = new MyMapOf_xsd_string_To_xsd_anyType(); 
                   //Set the Description attribute 
                   ConsoleApplication1.ServiceReference1.MyMapOf_xsd_string_To_xsd_anyType_Item desAttribute = new MyMapOf_xsd_string_To_xsd_anyType_Item(); 
                   desAttribute.key = "{http://www.alfresco.org/model/content/1.0}description"; 
                   desAttribute.value = "A mortgage application form"; 
                   //Set the creator attribute 
                   ConsoleApplication1.ServiceReference1.MyMapOf_xsd_string_To_xsd_anyType_Item creator = new MyMapOf_xsd_string_To_xsd_anyType_Item(); 
                   creator.key = "{http://www.alfresco.org/model/content/1.0}creator"; 
                   creator.value = "Tony Blue"; 
                   //Set the items to the MyMapOf_xsd_string_To_xsd_anyType instance 
                   //Store MortgageForm.pdf in /Company Home/Test Directory 
                           out browseLink, 
                           out result);  
                   //Get the identifier value of the new content 
                   String conentId = result.nodeUuid; 
                   Console.WriteLine("The identifier value of the new content is " + conentId);  
               catch (Exception ee) 

// Ethnio survey code removed