How to get all mail folder list in Microsoft graph API

We will share with you in this article How to get all mail folder list in Microsoft graph API.

Please refer the accesstoken from this link.

$curl = curl_init();
$accessToken = ""; //Get the access token from your database or txt file
curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://graph.microsoft.com/v1.0/me/mailFolders/?includeHiddenFolders=true',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'Authorization: Bearer '
  ),
));

$response = curl_exec($curl);
curl_close($curl);
echo $response;

I hope it will help you.