Quick Start (MTOM): Setting Content Services Permissions using the web service API (Deprecated)

The following C# code example sets a permission for a user named tony blue. The domain that is specified is the default domain. The Consumer permission is specified and the node is /Company Home/Test Directory. (See Setting Content Services (deprecated) Permissions.)

???/** 
    * 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 SetPermissions.ServiceReference1; 
 
namespace SetPermissions 
{ 
       class Program 
       { 
           static void Main(string[] args) 
           { 
               try 
               { 
                   //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"); 
 
                   //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 permission 
                   ContentAccessPermission permission = new ContentAccessPermission(); 
                   permission.authority = "tblue/DefaultDom"; 
                   permission.isAllowed = false; 
                   permission.permission = "Consumer";  
     
                   //Create a collection to hold the values 
                   SetPermissions.ServiceReference1.MyArrayOfContentAccessPermission permissionList = new SetPermissions.ServiceReference1.MyArrayOfContentAccessPermission(); 
                   permissionList.Add(permission); 
 
                   //Set the permission 
                   docManagement.writePermissions(storeName, 
                            nodeName, 
                            permissionList, 
                           false);  
                } 
               catch (Exception ee) 
               { 
                   Console.WriteLine(ee.Message); 
               } 
 
           } 
       } 
}