Quick Start (MTOM): Create Content Services spaces using the web service API (Deprecated)

The following C# code example creates a new space named New Directory located in Company Home. The identification value of the new space is written to the console. (See Creating Content Services (deprecated) Spaces.)

???/** 
    * 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 CreateSpace.ServiceReference1; 
 
namespace CreateSpace 
{ 
       class Program 
       { 
           static void Main(string[] args) 
           { 
               try 
               { 
                   //Specify the name of the store and node 
                   String storeName = "SpacesStore"; 
                   String nodeName = "/Company Home/New Directory"; 
 
                   //Create a DocumentManagementServiceClient object 
                   DocumentManagementServiceClient docManagement = new DocumentManagementServiceClient(); 
                   docManagement.Endpoint.Address = new System.ServiceModel.EndpointAddress("http://hiro-xp:8080/soap/services/DocumentManagementService"); 
     
                   //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; 
 
                   //Create a new space 
                   String spaceId = docManagement.createSpace(storeName, nodeName); 
                   Console.WriteLine("The identifier value of the new space is " +spaceId); 
     
               } 
               catch (Exception ee) 
               { 
                   Console.WriteLine(ee.Message); 
               } 
 
           } 
       } 
}