【问题标题】:Add event on user shared calendar在用户共享日历上添加事件
【发布时间】:2020-11-17 15:51:19
【问题描述】:

我正在使用Garethp/php-ews 包来管理 Exchange 数据。

我可以阅读其他用户与我共享的日历,但除非他们授予我在他们的日历上的写入权限(在 Web 客户端下,我可以添加事件),否则我无法通过 php 添加事件。

我想我必须使用

$calendar = $api->getCalendar();
$userCalendar = $calendar->pickCalendar($displayName);

如果我是对的,如何获得他的$displayName

谢谢

【问题讨论】:

    标签: php soap php-ews


    【解决方案1】:

    我想我找到了解决办法:

    $this->api = API::withUsernameAndPassword($server, $your_username, $your_password
    $this->api->setPrimarySmtpEmailAddress('user_shared_calendar@test.com');
    
    $folder = $this->api->getFolderByDistinguishedId('calendar');
    $calendar = $this->api->getCalendar();
    $calendar->setFolderId($folder->getFolderId());
    
    $start = new \DateTime('now');
    $start->setTimezone(new \DateTimeZone('Europe/Paris'));
    $end = new \DateTime('now');
    $end->add(new \DateInterval('PT1H'));
    
    $calendar->createCalendarItems([
        'Subject' => 'This is made by PHP',
        'Body' => [
          'BodyType' => API\Enumeration\BodyTypeType::HTML,
          '_value' => 'This is <b>the</b> HTML body',
        ],
      'Start' => $start->format('c'),
      'End' => $end->format('c'),
    ]);
    
    

    此脚本在共享日历上添加事件。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多