I am trying to delete an event using Microsoft Graph API.
My issue is that I couldn't delete an event even the response returns success.
(regarding the official doc, success returns null)
My technical stack is CakePHP v4.x and I code like the following.
$http = new Client();
$appToken = $this->getRequest()->getSession()->read('appToken');
if ($this->request->is('ajax')) {
$this->autoRender = false;
}
$url = "https://graph.microsoft.com/v1.0/users/{user-id}/calendar/events/{event-id}";
$response_delete = json_decode($http->delete($url, [], [
'headers' => ['Authorization' => 'Bearer '. $appToken]
])->getBody()->getContents(), true);
// $response_delete = null
$appToken
is the application token so a company user can delete an event.
The token works fine and also I already have the full permissions on Azure active directory.
But real strange thing is that the same code works properly on my local side.
I merged my all updated codes using Git and compared the codebase several times, but I didn't have any luck.
I am not sure why it does happen.
Thanks in advance.
UPDATE: The application token
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…