使用Microsoft graph php sdk创建事件
我尝试使用PHPSDK创建事件,但设置开始和结束时区不起作用使用Microsoft graph php sdk创建事件,php,microsoft-graph-api,microsoft-graph-sdks,microsoft-graph-calendar,Php,Microsoft Graph Api,Microsoft Graph Sdks,Microsoft Graph Calendar,我尝试使用PHPSDK创建事件,但设置开始和结束时区不起作用 $e = new Model\Event(); $e->setSubject($subject); $start = new Model\DateTimeTimeZone(); $start->setDateTime($startDateTime); $start->setTimeZone($startTimeZone); $e->setStart($start); $e->setEnd(
$e = new Model\Event();
$e->setSubject($subject);
$start = new Model\DateTimeTimeZone();
$start->setDateTime($startDateTime);
$start->setTimeZone($startTimeZone);
$e->setStart($start);
$e->setEnd($start);
$body = new Model\ItemBody();
$body->setContentType(Model\BodyType::HTML);
$body->setContent($content);
$e->setBody($body);
但结果事件每次都是UTC
我试过:
$e->setOriginalStartTimeZone($startTimeZone);
$e->setOriginalEndTimeZone($startTimeZone);
以及添加标题:
Prefer: outlook.timezone="Pacific Standard Time"
但结果是一样的
最重要的是,当我添加
$e->setReminderMinutesBeforeStart(8);
$e->setIsReminderOn(true);
其余部分被禁用。如果我没有包含此代码,则会在事件发生前15分钟启用提醒。您正在将日期时间
和时区
设置为UTC
。我不确定您希望发生什么,但这应该会使用UTC
生成一个新的事件
当您使用Z
后缀指定时间时,告诉它“这是协调世界时”。这相当于将日期/时间偏移设置为:
使用UTC的时区有时表示为UTC±00:00
或字母Z
,这是对等效航海时区(GMT)的参考,大约从1950年起,就用Z
表示
如果你想使用“太平洋标准时间”,那么你会想使用
$start = new Model\DateTimeTimeZone();
$start->setDateTime("2019-03-11T21:01:57");
$start->setTimeZone("Pacific Standard Time");
虽然您可以简单地使用-08:00
作为UTC偏移量(我对PHP SDK的使用经验不足,不知道这是否可行,但我想会的):
有人能帮忙吗?$startDateTime
和$startTimeZone
的价值是多少?谢谢你的帮助。请检查此屏幕截图。我尝试使用图形浏览器的查询表单。
$start = new Model\DateTimeTimeZone();
$start->setDateTime("2019-03-11T21:01:57-08:00");