How to delete a scheduled task from plugin(nop 3.80)

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
5 years ago
Hi

My plugin installs a new task like this and it works:

_scheduleTaskService.InsertTask(new ScheduleTask
        {
            Enabled = true,
            Name = "MyTask",
            Seconds = 1800,
            StopOnError = false,
            Type = "Nop.Plugin.Shipping.LabelsInt.labelsShippingStatusTask, Nop.Plugin.Shipping.LabelsInt",
        });

But I can´t get it uninstalled, anyone with an example :-)

Thank you
5 years ago
WeroShop.dk wrote:
Hi

My plugin installs a new task like this and it works:

_scheduleTaskService.InsertTask(new ScheduleTask
        {
            Enabled = true,
            Name = "MyTask",
            Seconds = 1800,
            StopOnError = false,
            Type = "Nop.Plugin.Shipping.LabelsInt.labelsShippingStatusTask, Nop.Plugin.Shipping.LabelsInt",
        });

But I can´t get it uninstalled, anyone with an example :-)

Thank you



here is your code,




  public override void Uninstall()
        {
     var ScheduleTask = _scheduleTaskService.GetTaskByType("Nop.Plugin.Shipping.LabelsInt.labelsShippingStatusTask, Nop.Plugin.Shipping.LabelsInt");
            if (ScheduleTask != null)
                _scheduleTaskService.DeleteTask(ScheduleTask);
    
    }




hope it would helpful.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.