Вопрос

Google says that setStatus property for the Tasks can be 'completed' and 'needsAction': https://developers.google.com/apps-script/class_tasks_v1_schema_task#setStatus

I'm using the API with the PHP library. When I insert a new task, I can set the status to 'completed' or 'needsAction'. But when I edit a task, if the task is already set as 'completed', I can't set the status to 'needsAction'.

So, the update works from 'needsAction' to 'completed', but not the other way. Directly on the web you can change the status however you like.

Anyone else with the same issue?

Это было полезно?

Решение

You also need to set the completedDate to null.

Другие советы

Hell, it took me an hour to solve this problem. Your PHP code should look like the following for it to work:

$task = new Google_Service_Tasks_Task();
$task->setCompleted(Google_Model::NULL_VALUE);
$task->setStatus('needsAction');
$service->tasks->patch($params->tlid, $params->tid, $task);

note the special Google_Model::NULL_VALUE which is documented here

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top