2016-09-26 11 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のブログで確認したものの!

は、私はあなたの助けが必要

エコーします$ result と何として偽(ブール値)を取得します。どうもありがとう!

答えて

2

私は、このようなgarethp/php-ews

+0

として、EWS用に構築されたライブラリを使用することをお勧めしますhttps://github.com/Garethp/php-ewsロックス – user2092317