1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
| <?php
//require_once 'php-ews/EWSAutodiscover.php';
require_once 'php-ews/EWS_Exception.php';
//require_once 'php-ews/EWSType.php';
//require_once 'php-ews/ExchangeWebServices.php';
//require_once 'php-ews/NTLMSoapClient.php';
//require_once 'php-ews/NTLMSoapClient.php';
//require_once 'php-ews/EWSType/FindFolderType.php';
//require_once 'php-ews/EWSType/FolderQueryTraversalType.php';
//require_once 'php-ews/EWSType/FolderResponseShapeType.php';
//require_once 'php-ews/EWSType/DefaultShapeNamesType.php';
//require_once 'php-ews/EWSType/IndexedPageViewType.php';
//require_once 'php-ews/EWSType/NonEmptyArrayOfBaseFolderIdsType.php';
//require_once 'php-ews/EWSType/DistinguishedFolderIdType.php';
//require_once 'php-ews/EWSType/DistinguishedFolderIdNameType.php';
require_once 'php-ews/NTLMSoapClient/Exchange.php';
/**
* Function to autoload the requested class name.
*
* @param string $class_name Name of the class to be loaded.
* @return boolean Whether the class was loaded or not.
*/
function __autoload($class_name)
{
// Start from the base path and determine the location from the class name,
$base_path = 'php-ews/';
$include_file = $base_path . '/' . str_replace('_', '/', $class_name) . '.php';
return (file_exists($include_file) ? require_once $include_file : false);
}
__autoload("FindFolderType");
$email= "*************************";
$username ="***********";
$password ="**";
$server = "***********";
$ews = new ExchangeWebServices($server, $email, $password);
if ($ews == True )
echo "C'est good</br>";
else
echo "it's not good</br>";
// start building the find folder request
$request = new EWSType_FindFolderType();
$request->Traversal = EWSType_FolderQueryTraversalType::SHALLOW;
$request->FolderShape = new EWSType_FolderResponseShapeType();
$request->FolderShape->BaseShape = EWSType_DefaultShapeNamesType::ALL_PROPERTIES;
// configure the view
$request->IndexedPageFolderView = new EWSType_IndexedPageViewType();
$request->IndexedPageFolderView->BasePoint = 'Beginning';
$request->IndexedPageFolderView->Offset = 0;
// set the starting folder as the inbox
$request->ParentFolderIds = new EWSType_NonEmptyArrayOfBaseFolderIdsType();
$request->ParentFolderIds->DistinguishedFolderId = new EWSType_DistinguishedFolderIdType();
$request->ParentFolderIds->DistinguishedFolderId->Id = EWSType_DistinguishedFolderIdNameType::INBOX;
// make the actual call
$response = $ews->FindFolder($request);
echo '<pre>'.print_r($response, true).'</pre>';
?> |
Partager