【问题标题】:Getting ms exchange server version using php-ews使用 php-ews 获取 ms 交换服务器版本
【发布时间】:2020-11-20 00:41:37
【问题描述】:

我正在使用php-ews 库(新版本)来显示我项目中用户的日历事件。用户可以在他们的个人资料中设置他们的 ms 交换帐户详细信息,然后在我的项目本身中使用日历。代码如下

$host = '{host_set_on_users_profile}';
$username = '{username_set_on_users_profile}';
$password = '{password_set_on_users_profile}';
$version = Client::VERSION_2016;

$client = new Client($host, $username, $password, $version);
$client->setTimezone($timezone);

// Build request
$request = new FindItemType();
// more request building code here

$response = $client->FindItem($request);

但我遇到了以下问题

[faultstring] => The specified server version is invalid.

原因是我使用了固定的 VERSION_2016 并且用户可以为该帐户设置任何版本的 ms Exchange。

那么有什么方法可以先根据主机、用户名和密码找出服务器版本吗?这样我就可以使用它来创建客户端对象

【问题讨论】:

    标签: php soap exchange-server exchangewebservices php-ews


    【解决方案1】:

    对于您的问题:通常,当您在响应中执行对 Exchange 的请求时,您还会获得响应的 Exchange 服务器的版本。请参阅https://docs.microsoft.com/en-us/exchange/client-developer/web-service-reference/expanddl-operation#successful-expanddl-response-example 文档中的标题元素虽然您没有获得良好可读的年份版本,但此版本号对应于某个版本。

    话虽如此,您可以例如使用虚拟邮件地址发出第一个简单的虚拟请求(如 expandDL),然后获取所有后续请求的版本。或者更好的是,您将第一个 FindItem 请求的版本设置为 2007,然后使用响应检索正确的版本。

    另一种选择是将您的请求版本始终设置为 2007,这是可能的最低版本。如果您不需要 GetInboxRule 或 GetPhoneCallInformation 等更高 Exchange 版本的功能,则可以执行此操作。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-12-28
      • 2013-09-25
      • 2017-12-23
      • 2015-10-25
      • 2018-06-26
      • 2022-11-19
      • 2012-08-31
      • 1970-01-01
      相关资源
      最近更新 更多