我正在使用Microsoft PHP图形库(microsoftgraph / msgraph-sdk-php)将文档保存在Onedrive for Business中。
例如,当我创建文件夹时,使用Microsoft Graph API创建项目(文件夹或上传文件)时遇到问题:
"Client error: `POST https://graph.microsoft.com/v1.0/drives/MYDRIVEID/items/MYPARENTFOLDERID/children` resulted in a `400 Bad Request` response: { "error": { "code": "invalidRequest", "message": "One of the provided arguments is not acceptable.", "innerError": { "request-id": "bec1d260-3efd-4417-ba80-96ec37078df6", "date": "2018-07-20T16:48:34" } } } "
开机自检
https://graph.microsoft.com/v1.0/drives/MYDRIVEID/items/MYPARENTFOLDERID/children
正文:
{"name":"Project1","folder":{}}
这是我正在执行的代码:
$graph->createRequest("POST","/drives/$driveId/items/$itemId/children")-
>attachBody($body)->setReturnType(Model\DriveItem::class)->execute();
我的猜测是该API期望发送的内容与我发送的内容有所不同,例如,我尝试更改了正文,
{"name":"Project1","folder":{"childCount":0}}
{"name":"Project1","folder":{},"@microsoft.graph.conflictBehavior":"rename"}
{"name":"Project1","folder":{"childCount":0},"@microsoft.graph.conflictBehavior":"rename"}
但是我仍然遇到相同的错误。
我不确定自己在做什么错
有什么想法吗?
预先感谢您的帮助
答案 0 :(得分:0)
我删除了应用程序注册,然后再次在Azure门户中注册了它。创建文件夹操作正在按预期方式工作。