我有以下代码:
// this method have a optional parameter
public static void Foo(int a = 3) { }
delegate void SampleDelegate(int a = 3);
static void Main(string[] args)
{
SampleDelegate del = Foo;
// pass Type.Missing
del.DynamicInvoke(Type.Missing);
}
我尝试发送对象数组的JSON有效负载,但是出现try {
$createCalendarEventUrl = '/me/calendar/events';
$graph = new Graph();
foreach($unsyncedEvents as $event) { // Loop through each event to sync with calendar
$graph->setAccessToken($this->OutlookTokenCacheService->getAccessToken());
$newCalendarEvent = $graph->createRequest('POST', $createCalendarEventUrl)
->attachBody(json_encode($event))
->execute();
$response = [
'success' => true,
'message' => 'Calendar has been synced!'
];
echo json_encode($response);
}
} catch(GuzzleHttp\Exception\BadResponseException $e) {
var_dump('<pre>', $e, '</pre>');
$response = [
'success' => false,
'message' => 'Could not sync calendar. Please check your entries and try again.'
];
echo json_encode($response);
}
错误。是否有另一种方法可以将多个事件发送到Outlook日历并保存它们?