Create folder on OneDrive with API

爱⌒轻易说出口 提交于 2019-12-11 03:04:02

问题


I am trying to create new folder on OneDrive through API, but I am getting Exception

Fatal error: Uncaught exception 'League\OAuth2\Client\Provider\Exception\IdentityProviderException' with message 'Must provide one of the following facets to create an item: Bundle, File, Folder, RemoteItem

This is with $a = ["name" => "Folder"];.

If I change it to this:

$a = ["name" => "Folder", "folder" => array()];
$this->provider->post('https://graph.microsoft.com/v1.0/me/drive/root/children',$a,$_SESSION['access_token']);

Then I get

Property folder in payload has a value that does not match schema

From the example page I am assuming that folder value should be empty array.


回答1:


Correct format for the folder was $folderParameters = ["name" => $folderName, "folder" => ["childCount" => '0']];



来源:https://stackoverflow.com/questions/42270392/create-folder-on-onedrive-with-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!