我正在使用microsoft-graph api sdk,这里是url:msgraph-sdk-php
我需要检查用户的约会在outlook日历中是否可用/忙碌。
我正在尝试使用以下代码
$graph = new Graph();
$graph->setAccessToken($this->getToken($calendar));
$data = [
'Schedules' => 'useremail@gmail.com',
'Start' => [
'DateTime' => '2019-06-8T09:00:00+0530',
'TimeZone' => 'Pacific Standard Time',
],
'End' => [
'DateTime' => '2019-06-9T09:00:00+0530',
'TimeZone' => 'Pacific Standard Time',
],
'availabilityViewInterval' => '30',
];
$url = "/me/calendar/getschedule";
$response = $graph->createRequest("POST", $url)
->attachBody($data)
->setReturnType(Model\ScheduleItem::class)
->execute();我收到以下错误:消息:“客户端错误:POST https://graph.microsoft.com/v1.0/me/calendar/getschedule导致400 Bad Request响应:代码”错误“:{↵{↵”↵“:"RequestBodyRead",↵”消息“:”当尝试读取null集合参数值I(截断...)↵时
我还检查了这个微软文档,详细信息如下:outlook-get-free-busy-schedule
我在文档中没有找到使用php microsoft-graph sdk的getschedule-api。我需要使用php microsoft-graph api sdk。
请为我提供有关此错误的任何解决方案。
谢谢。
发布于 2019-06-08 18:14:39
我们不需要通过
setReturnType尝试使用以下命令:
$data = [
'Schedules' => ['avniphadkar@gmail.com'],
"StartTime" => (object)[
"dateTime" => "2019-06-08T09:00:00",
"timeZone" => "Pacific Standard Time"
],
"EndTime" => (object)[
"dateTime" => "2019-06-8T23:00:00",
"timeZone" => "Pacific Standard Time"
],
'availabilityViewInterval' => '30'
];
$url = "/me/calendar/getschedule";
$response = $graph->createRequest("POST", $url)
->attachBody($data)
->execute();
print_r($response);
希望这能帮上忙。
https://stackoverflow.com/questions/56504916
复制相似问题