Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once 'php-ews/EWSType.php';
- require_once 'php-ews/EWS_Exception.php';
- require_once 'php-ews/NTLMSoapClient.php';
- require_once 'php-ews/NTLMSoapClient/Exchange.php';
- require_once 'php-ews/ExchangeWebServices.php';
- require_once 'php-ews/EWSType/ItemType.php';
- require_once 'php-ews/EWSType/FindItemType.php';
- require_once 'php-ews/EWSType/ItemQueryTraversalType.php';
- require_once 'php-ews/EWSType/ItemResponseShapeType.php';
- require_once 'php-ews/EWSType/DefaultShapeNamesType.php';
- require_once 'php-ews/EWSType/CalendarItemType.php';
- require_once 'php-ews/EWSType/CalendarViewType.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/EWSType/EmailAddressType.php';
- require_once 'php-ews/EWSType/BodyType.php';
- $today = Date("Y-m-d");
- $host = 'EXCHANGE.YOURSERVER.COM';
- $username = 'USERNAME';
- $password = 'PASSWORD';
- $localTZ = 'America/New_York';
- $daysahead = '1'; // Today Only
- $EWScalendar = 'EMAILADDRESSOFCALENDAR@YOURDOMAIN.COM';
- $ews = new ExchangeWebServices ($host, $username, $password);
- $request = new EWSType_FindItemType();
- $request->Traversal = EWSType_ItemQueryTraversalType::SHALLOW;
- $request->ItemShape = new EWSType_ItemResponseShapeType();
- $request->ItemShape->BaseShape = EWSType_DefaultShapeNamesType::DEFAULT_PROPERTIES;
- $request->CalendarView = new EWSType_CalendarViewType();
- $request->CalendarView->StartDate = date ('c',strtotime("$today"));
- $request->CalendarView->EndDate = date ('c',strtotime("$today + $daysahead days"));
- $request->ParentFolderIds = new EWSType_NonEmptyArrayOfBaseFolderIdsType();
- $request->ParentFolderIds->DistinguishedFolderId = new EWSType_DistinguishedFolderIdType();
- $request->ParentFolderIds->DistinguishedFolderId->Id = EWSType_DistinguishedFolderIdNameType::CALENDAR;
- $mailBox = new EWSType_EmailAddressType();
- $mailBox->EmailAddress = "$EWScalendar";
- $request->ParentFolderIds->DistinguishedFolderId->Mailbox = $mailBox;
- $response = $ews->FindItem($request);
- $TotalItemCount = $response->ResponseMessages->FindItemResponseMessage->RootFolder->TotalItemsInView;
- // LOOP through the Event Data and Parse each item
- echo '<?xml version="1.0" encoding="iso-8859-1" ?>' . "\n";
- ?>
- <rss version="2.0">
- <channel>
- <title>ROOM NAME</title>
- <copyright>WHOCARES</copyright>
- <link>http://DOESNOTMATTER.COM</link>
- <description>ROOM NAME</description>
- <?
- if($TotalItemCount > 1)
- {
- for ( $ItemID = 0; $ItemID < $TotalItemCount; $ItemID++) {
- //--do something with item data--
- $subject = $response->ResponseMessages->FindItemResponseMessage->RootFolder->Items->CalendarItem[$ItemID]->Subject;
- $startTS = $response->ResponseMessages->FindItemResponseMessage->RootFolder->Items->CalendarItem[$ItemID]->Start;
- $endTS = $response->ResponseMessages->FindItemResponseMessage->RootFolder->Items->CalendarItem[$ItemID]->End;
- $startTS = strftime('%R', strtotime($startTS));
- $endTS = strftime('%R', strtotime($endTS));
- ?>
- <item>
- <title><?=$subject?></title>
- <link>http://WHOCARES.COM/</link>
- <pubDate>Sat, 14 Feb 2006 18:58:46 GMT</pubDate>
- <description><?=$startTS?> - <?=$endTS?></description>
- </item>
- <?
- }
- }
- else if($TotalItemCount ==1)
- {
- $subject = $response->ResponseMessages->FindItemResponseMessage->RootFolder->Items->CalendarItem->Subject;
- $startTS = $response->ResponseMessages->FindItemResponseMessage->RootFolder->Items->CalendarItem->Start;
- $endTS = $response->ResponseMessages->FindItemResponseMessage->RootFolder->Items->CalendarItem->End;
- $startTS = strftime('%R', strtotime($startTS));
- $endTS = strftime('%R', strtotime($endTS));
- ?>
- <item>
- <title><?=$subject?></title>
- <link>http://WHOCARES.COM/</link>
- <pubDate>Sat, 14 Feb 2006 18:58:46 GMT</pubDate>
- <description><?=$startTS?> - <?=$endTS?></description>
- </item>
- <?}?>
- </channel>
- </rss>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement