title: How to create a folder without an error using Microsoft Graph API?
body: <p>I am trying to create a folder in my team's Sharepoint folder using CakePHP, but it says an error.
  I tried several ways to post and call APIs, but everything didn't work.
  My API is</p>
  <pre><code>https://graph.microsoft.com/v1.0/drives/{drive-id}/root:/{folder-name}:/children
  </code></pre>
  <p>And I built this function below.</p>
  <pre><code>private function createNewFolder($folder_name)
  {
      try {
          $http = new Client();
          $accessToken = $this-&gt;getRequest()-&gt;getSession()-&gt;read('accessToken');
          
          $data = [
              &quot;name&quot; =&gt; $folder_name,
              &quot;folder&quot; =&gt; &quot;{ }&quot;,
              &quot;@microsoft.graph.conflictBehavior&quot; =&gt; &quot;rename&quot;
          ];
          
          $url = &quot;https://graph.microsoft.com/v1.0/drives/{drive-id}/root:/{folder-name}:/children&quot;;
          
          $headers = [
              'headers' =&gt; ['Authorization' =&gt; 'Bearer '. $accessToken, 'Content-Type' =&gt; 'application/json']
          ];
  
          return $http-&gt;post($url, json_encode($data), $headers)-&gt;getJson();
      } catch
      (\Exception $e) {
          return $e-&gt;getMessage();
      }
  }
  </code></pre>
  <p>It says an error,</p>
  <blockquote>
  <p>&quot;Property folder in payload has a value that does not match schema.&quot;</p>
  </blockquote>
  <p>Although it works using Postman, but it doesn't work in website.</p>
  <p>I already allowed permissions including <code>Files.ReadWrite, Files.ReadWrite.All, Sites.ReadWrite.All</code> in Active Directory.</p>