SaveNewLicenseEx Method
Overloads
| SaveNewLicenseEx(License) | 
             Sets a signed key license from version 12.50.  | 
        
      
    
SaveNewLicenseEx(License)
Sets a signed key license from version 12.50.
Declaration
      LicenseDefinition SaveNewLicenseEx(License license)
    
  Parameters
| Type | Name | Description | 
|---|---|---|
| License | license | 
           License to set.  | 
      
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
            IQMS6 apiClient = new QMS6Client();
            //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
            List<ServiceInfo> qvsServices = apiClient.GetServices(ServiceTypes.QlikViewServer);
            //retrieve a time limited service key
            ServiceKeyClientMessageInspector.ServiceKey = apiClient.GetTimeLimitedServiceKey();
            //Set the license
            LicenseDefinition result = apiClient.SaveNewLicenseEx(newsignedKeyLicense);
            //Check the result
            if(result != null)
            {
                Console.WriteLine("License was successfully set.");
                foreach (ServiceInfo qvs in qvsServices)
                {
                   apiClient.RestartQVS(qvs.ID);
                }
            }
        }
        catch (Exception ex)
        {
            Console.WriteLine("An exception occurred: " + ex.Message);
        }
        // wait for user to press any key
        Console.ReadLine();
    }
}