nowise / uup-ews
Microsoft Exchange Web Service (EWS) 库
0.9.2
2019-10-15 02:22 UTC
Requires
- php: >=5.4.0
Suggests
This package is auto-updated.
Last update: 2024-09-15 14:09:27 UTC
README
用于与 EWS 通信的 SOAP 客户端库。大部分代码是从 Exchange 服务器下载的 WSDL/XSD 自动生成的。
此项目实际上并未得到维护(缺少用例),并且仅针对 Exchange 2013 进行了测试,但仍然希望对某人有所帮助!
注意
配置目录中捆绑的 WSDL 和 XSD 文件可能需要替换以匹配您组织运行中的 Exchange 服务器。在更新 WSDL 时,请记住重新生成源/UUP/Exchange/Types 中的 PHP 类。
更新 WSDL/XSD 文件
通过运行以下命令从 Exchange 服务器下载服务、消息和类型定义:
for f in services.wsdl messages.xsd types.xsd; do \ curl -v --ntlm --user user@example.com \ https://server.example.com/ews/$f > config/$f done
在 config/services.wsdl 的末尾追加服务定义。将 server.example.com 替换为实际交换服务器以提供默认主机
<wsdl:service name="ExchangeServices"> <wsdl:port name="ExchangeServicePort" binding="tns:ExchangeServiceBinding"> <soap:address location="https://server.example.com/ews/exchange.asmx" /> </wsdl:port> </wsdl:service>
更新 PHP 类
- 使用捆绑的脚本来从 WSDL 生成 PHP 类。首先需要安装建议的 composer 包 wsdl2phpgenerator。
composer require wsdl2phpgenerator/wsdl2phpgenerator php bin/generate.php
- 下载 wsdl2phpgenerator 的 CLI 版本,然后从配置目录中的 WSDL 文件生成 PHP 类
php ~/wsdl2phpgenerator.phar -i config/services.wsdl \ -o source/UUP/Exchange/Types -n "UUP\\Exchange\\Types" \ --noIncludes --constructorNull --createAccessors
有关更多信息,请参阅 wsdl2phpgenerator 的文档
- https://github.com/wsdl2phpgenerator/wsdl2phpgenerator
- https://github.com/wsdl2phpgenerator/wsdl2phpgenerator-cli
测试
可以在 bin 目录中找到一个简单的 PHP 脚本,用于测试连接和日历事件的 CRUD 操作。
php bin/client.php --user=user@example.com --pass=secret \ --host=exchange.example.com \ --find --start="2015-11-25" --end="2015-12-01"
php bin/client.php --user=user@example.com --pass=secret \ --host=exchange.example.com \ --add --start="2015-11-25" --end="2015-12-01" \ --title="TEST" --body="Some text..."
php bin/client.php --user=user@example.com --pass=secret \
--host=exchange.example.com \
--delete --id="AABCurZhAAA="
参考
如何:使用 EWS 在 Exchange 2013 中创建会议和约会 (外部链接)