2016-09-26 3 views
2

나는 마이크로 소프트 EWS의 API에서 일정 데이터를 얻을 수있는 간단한 PHP 스크립트를 작성하려합니다 :EWS의 nusoap PHP는 요청이있는 FindItem 작동

include_once('./lib/nusoap.php'); 

    $username = '[email protected]'; 
    $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 블로그에 의해 확인되었지만!

은 내가 당신의 도움이 필요

반향 달러 (A $) 결과 아무것도 False로 (부울)를 얻는다. 많은 감사!

답변

2

나는 EWS 위해 만들어진 라이브러리를 사용하는 것이 좋습니다 것 같은 garethp/php-ews

+0

https://github.com/Garethp/php-ews 바위 – user2092317