使用API在OneDrive上创建文件夹 [英] Create folder on OneDrive with API
问题描述
我试图通过API在OneDrive上创建新文件夹,但出现异常
I am trying to create new folder on OneDrive through API, but I am getting Exception
致命错误:消息为必须提供以下方面之一才能创建项目:消息,捆绑包,文件,文件夹,RemoteItem"的未捕获异常'League \ OAuth2 \ Client \ Provider \ Exception \ IdentityProviderException'
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
这是$a = ["name" => "Folder"];
.
如果我将其更改为此:
$a = ["name" => "Folder", "folder" => array()];
$this->provider->post('https://graph.microsoft.com/v1.0/me/drive/root/children',$a,$_SESSION['access_token']);
然后我得到
有效负载中的属性文件夹的值与架构不匹配
Property folder in payload has a value that does not match schema
在示例页面中,我假设folder
值应为空大批.
From the example page I am assuming that folder
value should be empty array.
推荐答案
该文件夹的正确格式为
$folderParameters = ["name" => $folderName, "folder" => ["childCount" => '0']];
Correct format for the folder was
$folderParameters = ["name" => $folderName, "folder" => ["childCount" => '0']];
这篇关于使用API在OneDrive上创建文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!