1
votes

We're on exchange 2007 and I'm using php-ews and I want to get a list of all the bookings for a room resource. By room resource, I mean the rooms button in outlook when creating a meeting invite.

The code I have so far returns items from my calendar but I need calendar from 'Conference room A'. Anyone have done this?

$host = 'mailhost';
$username = 'xxxx';
$password = 'xxxx';
$mail = 'xxxx';
$startDateEvent = "2013-01-14T09:00:00";
$endDateEvent = "2013-09-20T17:00:00";

$ews = new ExchangeWebServices($host, $username, $password);
$request = new EWSType_FindItemType();
$request->Traversal = EWSType_FolderQueryTraversalType::SHALLOW;

$request->CalendarView->StartDate = $startDateEvent; 
$request->CalendarView->EndDate = $endDateEvent; 
$request->CalendarView->MaxEntriesReturned = 100;
$request->CalendarView->MaxEntriesReturnedSpecified = true;
$request->ItemShape->BaseShape = EWSType_DefaultShapeNamesType::ALL_PROPERTIES;

$request->ParentFolderIds->DistinguishedFolderId->Id = EWSType_DistinguishedFolderIdNameType::CALENDAR;   
$request->ParentFolderIds->DistinguishedFolderId->Mailbox->EmailAddress = $mail;
$response = $ews->FindItem($request);
echo '<pre>'.print_r($response, true).'</pre>';
2

2 Answers

1
votes

I'm even later to the game. But The way I solved this was to create an exchange account after the name of the room, for instance boardroom@.

Then I got people to copy in boardroom@ whenever they sent out a meeting request. My scripts simply interrogate boardroom@'s calendar. Everyone at the organisation has a copy of boardroom's calendar in read-only mode that they can look at to see all the meetings that week.

My software was for a display sign outside the room that showed whether the room was in use or not based upon this calendar.

0
votes

Late to the game but maybe this will help someone....

Basically, php-ews never added the GetRooms operation. You could modify your app to perform the room lookup via ldap (assuming your rooms exist in AD) and then use the email address of each room and query it's calendar using impersonation.

See my answer here... https://stackoverflow.com/a/23815914/2979715