문제

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