使用 php-ews 我尝试通过示例创建一个日历事件(只是为了掌握它):
require $server_path.'scripts/ews/vendor/autoload.php';
use garethp\ews\API;
use garethp\ews\API\Enumeration;
use garethp\ews\API\Type;
$ews = API::withUsernameAndPassword($exchange_host, $_SESSION["user_data"]["u_email"], $_SESSION["user_data"]["u_pwd"]);
似乎工作没有错误。
// Start building the request.
$calendar = $ews->getCalendar();
$start = new DateTime('8:00 AM');
$end = new DateTime('9:00 AM');
$request = array(
'Items' => array(
'CalendarItem' => array(
'Start' => $start->format('c'),
'End' => $end->format('c'),
'Body' => array(
'BodyType' => Enumeration\BodyTypeType::HTML,
'_value' => 'This is <b>the</b> body'
),
'ItemClass' => Enumeration\ItemClassType::APPOINTMENT,
'Sensitivity' => Enumeration\SensitivityChoicesType::NORMAL,
'Categories' => array('Testing', 'php-ews'),
'Importance' => Enumeration\ImportanceChoicesType::NORMAL
)
),
'SendMeetingInvitations' => Enumeration\CalendarItemCreateOrDeleteOperationType::SEND_TO_NONE
);
$request = Type::buildFromArray($request);
$response = $ews->CreateItem($request);
我得到:
PHP 致命错误:调用未定义的方法 garethp\ews\API::CreateItem()
在执行部分 ($ews->CreateItem())