| IQMSTriggerEDXTask Method |
Namespace: PIX.Services.V12
TriggerEDXTaskResult TriggerEDXTask( Guid qdsID, string taskNameOrID, string password, string variableName, List<string> variableValues )
Requires membership of local group QlikView EDX. |
If the task name matches multiple tasks, no task will be started abd the EDXTaskStartResult will be set to CouldNotDetermineTaskByName.
If the provided password is wrong, a new log entry will be created in the event log with information about the name of the task and the id of the calling user.
If the task does exist, the result will have its EDXTaskStartResult field set to TaskNotFound.
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 System.Threading; using QMSAPI; class Program { static void Main(string[] args) { try { // create a QMS API client IQMS apiClient = new QMSClient(); //retrieve a time limited service key ServiceKeyClientMessageInspector.ServiceKey = apiClient.GetTimeLimitedServiceKey(); //Get a Distribution Service. ServiceInfo qdsService = apiClient.GetServices(ServiceTypes.QlikViewDistributionService).FirstOrDefault(); if (qdsService != null) { //Trigger the task TriggerEDXTaskResult result = apiClient.TriggerEDXTask(qdsService.ID, "PauseEDX", "edx", "", new List<string>()); EDXStatus executionStatus = null; //Wait until the task is completed or 60 seconds has passed. SpinWait.SpinUntil(() => { System.Threading.Thread.Sleep(1000); Console.WriteLine("Checking the task..."); //Get the current state of the task. executionStatus = apiClient.GetEDXTaskStatus(qdsService.ID, result.ExecId); //Return true if the task has completed. return executionStatus != null && executionStatus.TaskStatus == TaskStatusValue.Completed; }, 60 * 1000); //Write the result if (executionStatus != null) Console.WriteLine(executionStatus.TaskStatus); else Console.WriteLine("Failed to get execution status."); } } catch (Exception ex) { Console.WriteLine("An exception occurred: " + ex.Message); } // wait for user to press any key Console.ReadLine(); } }