我一直在寻找相同的解决方案,然后我发现:
您首先需要一个对您要创建的日历具有“所有者”权限的用户(您可以使用您的管理员帐户进行测试)然后您需要在 base64 中编码您的登录密码转到此站点,您可以在线进行
http:/ /www.tools4noobs.com/online_php_functions/base64_encode/
然后选择“base64encode”写在这个例子里面:john.smith@domain.com:password
复制结果:示例 am9obi5zbWl0aEBkb21haW4uY29tOnBhc3N3b3Jk
1 步:读取事件(在 php 中):
<?
$mail = "eric.blik@domain.com"; // agenda email you want to check
$opts = array(
'http'=>array(
'method'=>"GET",
'header'=>"Authorization: Basic am9obi5zbWl0aEBkb21haW4uY29tOnBhc3N3b3Jk"
// replace after basic by the password
)
);
$context = stream_context_create($opts);
$ret_event = file_get_contents("https://outlook.office365.com/api/v1.0/users/" . $mail . "/calendarview?startDateTime=2015-06-30T09:00:00Z&endDateTime=2015-06-30T18:00:00Z", false, $context);
echo "<pre>";
print_r(json_decode($ret_event));
echo "</pre>";
?>
第二步:编写事件(在 php 中):
<?
$mail = "eric.blik@domain.com"; // agenda email you want ot add event
$url = "https://outlook.office365.com/api/v1.0/users/" . $mail . "/events";
$fuseau = date("P");
$titre = "Hello"; // Title
$description = "Welcome to our world"; // Content can be html
// Time zone is for France, check yours
// Change the date time for your event
$data_json = '{ "Subject": "' . $titre . '",
"Body": {
"ContentType": "HTML",
"Content": "' . $description . '"
},
"Start": "2015-07-07T18:00:00' . $fuseau . '",
"StartTimeZone": "Romance Standard Time",
"End": "2015-07-07T19:00:00' . $fuseau . '",
"EndTimeZone": "Romance Standard Time",
"Attendees": [
{
"EmailAddress": {
"Address": "' . $mail . '",
"Name": "TEST"
},
"Type": "Required"
}
]
}';
$options = array("http" => array( "method" => "POST",
"header" => "Authorization: Basic am9obi5zbWl0aEBkb21haW4uY29tOnBhc3N3b3Jk\r\n" .
"Content-type: application/json\r\n",
"content" => $data_json
));
$context = stream_context_create($options);
$retour_create_event = file_get_contents($url, false, $context);
echo "<pre>";
print_r(json_decode($retour_create_event));
echo "</pre>";
$id = json_decode($retour_create_event)->Id;
echo "Id of the event : " . $id;
?>
现在检查您的议程,您将拥有您的活动您可以添加很多设置,例如类别或其他信息
它也适用于电子邮件、Onenote 和 Sharepoint。
等待您的反馈意见