Guest User

Untitled

a guest
May 23rd, 2018
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. #!/opt/local/bin/php
  2. <?
  3. function __autoload($className)
  4. {
  5. $className = str_replace('_','/', $className);
  6. $sFileName = '../vendor/php-ews/' . $className . '.php';
  7.  
  8. if (file_exists($sFileName) && !class_exists($className))
  9. {
  10. require_once $sFileName;
  11. }
  12. // If the above if fails, you're program will terminate, there is no way to catch this.
  13. }
  14.  
  15. include("../vendor/php-ews/ExchangeWebServices.php");
  16.  
  17. $host = "ews.mex02.emailsrvr.com";
  18. $username = "radium_exchange@raxapp.com";
  19. $password = "Racker123$";
  20.  
  21. $ews = new ExchangeWebServices($host, $username, $password);
  22.  
  23. // start building the find folder request
  24. $request = new EWSType_FindFolderType();
  25. $request->Traversal = EWSType_FolderQueryTraversalType::SHALLOW;
  26. $request->FolderShape = new EWSType_FolderResponseShapeType();
  27. $request->FolderShape->BaseShape =
  28. EWSType_DefaultShapeNamesType::ALL_PROPERTIES;
  29.  
  30. // configure the view
  31. $request->IndexedPageFolderView = new EWSType_IndexedPageViewType();
  32. $request->IndexedPageFolderView->BasePoint = 'Beginning';
  33. $request->IndexedPageFolderView->Offset = 0;
  34.  
  35. // set the starting folder as the inbox
  36. $request->ParentFolderIds =
  37. new EWSType_NonEmptyArrayOfBaseFolderIdsType();
  38. $request->ParentFolderIds->DistinguishedFolderId =
  39. new EWSType_DistinguishedFolderIdType();
  40. $request->ParentFolderIds->DistinguishedFolderId->Id =
  41. EWSType_DistinguishedFolderIdNameType::INBOX;
  42.  
  43. // make the actual call
  44. $response = $ews->FindFolder($request);
  45.  
  46. echo $response;
  47.  
  48. echo '<pre>'.print_r($response, true).'</pre>';
  49. ?>
Add Comment
Please, Sign In to add comment