SaveNewLicense Method
Overloads
| SaveNewLicense(License, Guid, String) | 
             Sets a signed key license.  | 
        
      
    
SaveNewLicense(License, Guid, String)
Sets a signed key license.
Declaration
      LicenseDefinition SaveNewLicense(License license, Guid serviceID, string licenseServer)
    
  Parameters
| Type | Name | Description | 
|---|---|---|
| License | license | 
           License to set.  | 
      
| System.Guid | serviceID | 
           ID of the QlikView Server service to set the license on.  | 
      
| System.String | licenseServer | 
           Name of the License Service.  | 
      
Returns
| Type | Description | 
|---|---|
| LicenseDefinition | 
           LicenseDefinition is returned if the operation was successful, otherwise an error message is returned.  | 
      
Remarks
security
Requires membership of local groups QlikView Management API and QlikView Administrator.
Examples
The following code example uses the QMS API to set a new server license.
The service key injection is assumed to be handled behind the scenes. For an example of how to inject the service key, see Samples.
    using System;
using System.Collections.Generic;
using System.Linq;
using QMSAPI;
class Program
{
    static void Main(string[] args)
    {
        try
        {
            // create a QMS API client
            IQMS4 apiClient = new QMS4Client();
            //Create the new license
            License newsignedKeyLicense = new License();
            newsignedKeyLicense.LicenseType = LicenseType.QlikViewServer;
            newsignedKeyLicense.SignedKey = "<A valid signed key>";
            //get license service name
            string licenseService = apiClient.GetServices(ServiceTypes.LicenseService)[0].Name;
            //get qvs id
            Guid qvsID = apiClient.GetServices(ServiceTypes.QlikViewServer)[0].ID;
            //retrieve a time limited service key
            ServiceKeyClientMessageInspector.ServiceKey = apiClient.GetTimeLimitedServiceKey();
            //Set the license
            LicenseDefinition result = apiClient.SaveNewLicense(newsignedKeyLicense, qvsID, licenseService);
            //Check the result
            if(LicenseDefinition != null)
                Console.WriteLine("License was successfully set.");
        }
        catch (Exception ex)
        {
            Console.WriteLine("An exception occurred: " + ex.Message);
        }
        // wait for user to press any key
        Console.ReadLine();
    }
}