【问题标题】:php ews Copy Message from inbox to other user's inboxphp ews 将邮件从收件箱复制到其他用户的收件箱
【发布时间】:2016-06-09 21:15:48
【问题描述】:

使用 php-ews 是否可以将邮件从收件箱复制到其他用户的收件箱?

目标是 php-ews 在 Web 界面中创建消息,保存到共享收件箱,然后将消息的副本保存到用户的收件箱。

到目前为止我的代码:

$id = $mail_items[$i]->ItemId->Id;
$change_key = $mail_items[$i]->ItemId->ChangeKey;

$request = new EWSType_CopyItemType();
$request->ToFolderId->FolderId->Id = $user_folder_id;
$request->ToFolderId->FolderId->ChangeKey = $user_folder_ckey;
$request->ItemIds->ItemId->Id = $id;
$request->ItemIds->ItemId->ChangeKey = $change_key;
$response = $ews->CopyItem($request);

邮件未出现在其他用户的收件箱中。谢谢!

【问题讨论】:

  • 您对此有何回应?
  • 响应是:EWS Id 采用 EwsLegacyId 格式,您的请求指定的 Exchange 版本不支持该格式
  • 您正在尝试将 Exchange 2007 ItemId 与 Exchange2010 一起使用。您需要转换 ID 或从服务器重新获取它
  • 你有转换ID的简短代码示例吗?
  • 我只能在我自己的库中向您展示,它与您正在使用的库相似,但更现代。使用我的看起来像这样github.com/Garethp/php-ews/blob/master/examples/basic/…,但您可以执行ConvertId 操作(此处为文档msdn.microsoft.com/en-us/library/office/…

标签: php exchangewebservices


【解决方案1】:

感谢 Gareth Parker,我的错误被发现了。 我忘记在我的客户中总是提供交换版本。

只需在您创建的每个客户端中指定相同的 Exchange 版本:

$ews = new ExchangeWebServices($host, $username, $password, ExchangeWebServices::VERSION_2007_SP1);

【讨论】:

    猜你喜欢
    • 2012-03-24
    • 2014-06-18
    • 1970-01-01
    • 2018-03-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多