2014-05-01 63 views
1

我正在与php-ews图书馆合作交流。我想知道是否有任何方法可以访问全球通讯录,我搜索了文档并没有出现。我想访问它,以便查看房间资源。php-ews访问全球通讯簿

感谢

回答

2

我不认为GetRooms方法曾被添加到php-ews中。看来他们只是停止发展。 看.. https://github.com/jamesiarmes/php-ews/issues/91

作为一种变通方法,如果在Active Directory中存在你的房间,你可以做一个LDAP查询使用房间的电子邮件地址,以获得它的日历用PHP来打通各个房间的房间,然后循环-ews。否则,您可以使用其电子邮件地址维护房间的数据库列表,并在循环之前以这种方式拉取它们。

一旦你有房间的电子邮件地址,你会使用Exchange模拟,冒充房间的电子邮件来检查它的日历。

事情是这样的......

// Configure impersonation using the conference OwnerEmailAddress 
    $ei = new EWSType_ExchangeImpersonationType(); 
    $sid = new EWSType_ConnectingSIDType(); 
    $sid->PrimarySmtpAddress = $email; 
    $ei->ConnectingSID = $sid; 
    $ews->setImpersonation($ei); 
    // Set the search for calendar item types 
    $request = new EWSType_FindItemType(); 
    $request->Traversal = EWSType_ItemQueryTraversalType::SHALLOW; 
    $request->ItemShape = new EWSType_ItemResponseShapeType(); 
    $request->ItemShape->BaseShape = EWSType_DefaultShapeNamesType::ALL_PROPERTIES; 
    $request->CalendarView = new EWSType_CalendarViewType(); 
    // Set the instance start and end times 
    $request->CalendarView->StartDate = $start->format('Y-m-d\TH:i:s'); 
    $request->CalendarView->EndDate = $end->format('Y-m-d\TH:i:s'); 
    // Set the search location as the calendars folder of the impersonated user 
    $request->ParentFolderIds = new EWSType_NonEmptyArrayOfBaseFolderIdsType(); 
    $request->ParentFolderIds->DistinguishedFolderId = new EWSType_DistinguishedFolderIdType(); 
    $request->ParentFolderIds->DistinguishedFolderId->Id = EWSType_DistinguishedFolderIdNameType::CALENDAR; 
    $request->ParentFolderIds->DistinguishedFolderId->Mailbox->EmailAddress = $email; 
    // Execute the search 
    $response = $ews->FindItem($request); 

在那里你提供$email$start$end。注意:您访问EWS API的帐户将需要模拟权限。

好运。