EWS nusoap php 请求 FindItem 操作
EWS nusoap php request FindItem Operation
我正在尝试编写一个简单的 php 脚本以从 Microsoft EWS API 获取日历数据:
include_once('./lib/nusoap.php');
$username = 'test@dopmain.com';
$password = 'password';
$endpoint = 'https://mex09.emailsrvr.com/ews/Services.wsdl';
$wsdl = true;
$soapclient = new nusoap_client($endpoint, $wsdl);
$soapclient->setCredentials($username, $password, 'ntlm');
$xml = '<FindItem xmlns="http://schemas.microsoft.com/exchange/services/2006/messages"';
$xml .= ' xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" Traversal="Shallow">';
$xml .= ' <ItemShape>';
$xml .= ' <t:BaseShape>IdOnly</t:BaseShape>';
$xml .= ' <t:AdditionalProperties>';
$xml .= ' <t:FieldURI FieldURI="message:From"/>';
$xml .= ' <t:FieldURI FieldURI="item:Subject"/>';
$xml .= ' <t:FieldURI FieldURI="message:IsRead"/>';
$xml .= ' <t:FieldURI FieldURI="item:DateTimeReceived"/>';
$xml .= ' <t:FieldURI FieldURI="calendar:Start"/>';
$xml .= ' <t:FieldURI FieldURI="calendar:End"/>';
$xml .= ' <t:FieldURI FieldURI="calendar:Location"/>';
$xml .= ' <t:FieldURI FieldURI="task:Status"/>';
$xml .= ' <t:FieldURI FieldURI="task:DueDate"/>';
$xml .= ' </t:AdditionalProperties>';
$xml .= ' </ItemShape>';
$xml .= ' <IndexedPageItemView Offset="0" MaxEntriesReturned="5" BasePoint="Beginning"/>';
$xml .= ' <ParentFolderIds>';
$xml .= ' <t:DistinguishedFolderId Id="inbox"/>';
$xml .= ' </ParentFolderIds>';
$xml .= '</FindItem>';
$operation = 'FindItem';
$result = $soapclient->call($operation, $xml);
var_dump($result);
echo '<pre>'; print_r($result); echo '</pre>';
尽管此代码已被许多 EWS 博客确认!!!
I get (bool) False as a $result
and nothing to echo
我需要你的帮助。非常感谢!
我建议使用为 EWS 构建的库,例如 garethp/php-ews
我正在尝试编写一个简单的 php 脚本以从 Microsoft EWS API 获取日历数据:
include_once('./lib/nusoap.php');
$username = 'test@dopmain.com';
$password = 'password';
$endpoint = 'https://mex09.emailsrvr.com/ews/Services.wsdl';
$wsdl = true;
$soapclient = new nusoap_client($endpoint, $wsdl);
$soapclient->setCredentials($username, $password, 'ntlm');
$xml = '<FindItem xmlns="http://schemas.microsoft.com/exchange/services/2006/messages"';
$xml .= ' xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" Traversal="Shallow">';
$xml .= ' <ItemShape>';
$xml .= ' <t:BaseShape>IdOnly</t:BaseShape>';
$xml .= ' <t:AdditionalProperties>';
$xml .= ' <t:FieldURI FieldURI="message:From"/>';
$xml .= ' <t:FieldURI FieldURI="item:Subject"/>';
$xml .= ' <t:FieldURI FieldURI="message:IsRead"/>';
$xml .= ' <t:FieldURI FieldURI="item:DateTimeReceived"/>';
$xml .= ' <t:FieldURI FieldURI="calendar:Start"/>';
$xml .= ' <t:FieldURI FieldURI="calendar:End"/>';
$xml .= ' <t:FieldURI FieldURI="calendar:Location"/>';
$xml .= ' <t:FieldURI FieldURI="task:Status"/>';
$xml .= ' <t:FieldURI FieldURI="task:DueDate"/>';
$xml .= ' </t:AdditionalProperties>';
$xml .= ' </ItemShape>';
$xml .= ' <IndexedPageItemView Offset="0" MaxEntriesReturned="5" BasePoint="Beginning"/>';
$xml .= ' <ParentFolderIds>';
$xml .= ' <t:DistinguishedFolderId Id="inbox"/>';
$xml .= ' </ParentFolderIds>';
$xml .= '</FindItem>';
$operation = 'FindItem';
$result = $soapclient->call($operation, $xml);
var_dump($result);
echo '<pre>'; print_r($result); echo '</pre>';
尽管此代码已被许多 EWS 博客确认!!!
I get (bool) False as a $result and nothing to echo
我需要你的帮助。非常感谢!
我建议使用为 EWS 构建的库,例如 garethp/php-ews