Skip to content

Instantly share code, notes, and snippets.

@datapimp
Created July 13, 2010 02:38
Show Gist options
  • Save datapimp/473379 to your computer and use it in GitHub Desktop.
Save datapimp/473379 to your computer and use it in GitHub Desktop.
#!/opt/local/bin/php
<?
function __autoload($className)
{
$className = str_replace('_','/', $className);
$sFileName = '../vendor/php-ews/' . $className . '.php';
if (file_exists($sFileName) && !class_exists($className))
{
require_once $sFileName;
}
// If the above if fails, you're program will terminate, there is no way to catch this.
}
include("../vendor/php-ews/ExchangeWebServices.php");
$host = "ews.mex02.emailsrvr.com";
$username = "radium_exchange@raxapp.com";
$password = "Racker123$";
$ews = new ExchangeWebServices($host, $username, $password);
// 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 $response;
echo '<pre>'.print_r($response, true).'</pre>';
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment