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

The following C# code searches /Company Home for a document that contains the text MortgageForm. The sub folders are also searched. When using web service, you have to create a lucene query string. (See Searching Content in 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 SearchContent.ServiceReference2; 
using System.ServiceModel; 
 
namespace SearchSpace 
{ 
      class Program 
       { 
           private const String USERNAME = "administrator"; 
           private const String PASSWORD = "password"; 
           private const String SERVICE_URI = "http://localhost:8080/soap/services/DocumentManagementService?wsdl"; 
 
 
          static void Main(string[] args) 
           { 
               try 
               { 
                  // Create a Service Client object 
                   DocumentManagementServiceClient docManagerClient = new DocumentManagementServiceClient(); 
                   docManagerClient.Endpoint.Address = new EndpointAddress(SERVICE_URI); 
                   BasicHttpBinding b = (BasicHttpBinding)docManagerClient.Endpoint.Binding; 
 
                   // Provide authentication credentials to the service 
                   docManagerClient.ClientCredentials.UserName.UserName = USERNAME; 
                   docManagerClient.ClientCredentials.UserName.Password = PASSWORD; 
                   b.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic; 
                   b.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly; 
 
                   //Specify the name of the store and node 
                   String path = "/Company Home"; 
                   String storeName = "SpacesStore"; 
 
                  //Create a Lucene Query expression (Search by files containing "MortgageForm" ) 
                   String luceneQuery = "@cm\\:name:\"MortgageForm\""; 
     
                   //Perform the search for a document that contains the text MortgageForm 
                   ResultSet rs = docManagerClient.searchRepositoryAPI(storeName, path, true, luceneQuery, 200); 
                   long resultSize = rs.resultSize; 
 
                   //Determines if the document is located in Content space 
                   if (resultSize > 0) 
                   { 
                       Console.WriteLine("MortgageForm is located in the Repository"); 
                    } 
               } 
 
               catch (Exception e) 
               { 
                   Console.WriteLine("An error occured: " + e.Message + "\n" + e.StackTrace); 
               } 
           } 
       } 
}