I'm having trouble trying to delete the task through the graph API with the following code
for index, row in tasks_df[:1].iterrows():
task_id_to_delete = row['TASK_ID']
print(task_id_to_delete)
delete_task_url = 'https://graph.microsoft.com/v1.0/planner/tasks/{task_id_to_delete}'
headers = {
'Authorization': f'Bearer {access_token}',
'If-Match': '*'
}
delete_task_response = requests.delete(delete_task_url, headers=headers)
if delete_task_response.status_code == 204:
print(f'Tarefa {task_id_to_delete} excluída com sucesso.')
else:
print(f'Erro ao excluir a tarefa {task_id_to_delete}: {delete_task_response.status_code} - {delete_task_response.text}')
It presents the following error: 500 -
{
"error": {
"code": "",
"message": "The given key was not present in the dictionary.",
"innerError": {
"date": "2024-03-01T14:36:11",
"request-id": "111111111111111111",
"client-request-id": "11111111111111111"
}
}
}