2011-07-14 15 views
0

次のコードスニペットは、追加のゲストを正常にGoogleカレンダーイベントに追加しますが、イベントの電子メール通知を送信していません。新しいゲストにメールを送ることができるかどうか誰かに教えてもらえますか?Zend Gdataカレンダーイベントアップデートは電子メール通知を送信しません

 $service = Zend_Gdata_Calendar::AUTH_SERVICE_NAME; // predefined service name for calendar 
$client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $service); 

function sendInvite($eventId, $email) 
{ 
    $gdataCal = new Zend_Gdata_Calendar($client); 
    if($eventOld = $this->getEvent($eventId)) 
    { 

     $who = $gdataCal->newwho(); 
     $who->setEmail($email); 

     $eventOld->setWho(array_merge(array($who), $eventOld->getWho())); 

     try 
     { 
      $eventOld->save(); 
     } catch(Zend_Gdata_App_Exception $e) 
     { 
      return false; 
     } 

     return true; 
    } else 
     return false; 
} 

function getEvent($eventId) 
{ 
    $gdataCal = new Zend_Gdata_Calendar($client); 
    $query = $gdataCal->newEventQuery(); 
    $query->setUser('default'); 
    $query->setVisibility('private'); 
    $query->setProjection('full'); 
    $query->setEvent($eventId); 
    try 
    { 
     $eventEntry = $gdataCal->getCalendarEventEntry($query); 
     return $eventEntry; 
    } catch(Zend_Gdata_App_Exception $e) 
    { 
     return null; 
    } 
} 

答えて

1

最後にわかりました。

public function sendInvite($eventId, $email) 
{ 
    $gdataCal = new Zend_Gdata_Calendar($this->client); 

    if($eventOld = $this->getEvent($eventId)) 
    { 
     $SendEventNotifications = new Zend_Gdata_Calendar_Extension_SendEventNotifications(); 
     $SendEventNotifications->setValue(true); 
     $eventOld->SendEventNotifications = $SendEventNotifications; 
     $who = $gdataCal->newwho(); 
     $who->setEmail($email); 

     $eventOld->setWho(array_merge(array($who), $eventOld->getWho())); 

     try 
     { 
      $eventOld->save(); 
     } catch(Zend_Gdata_App_Exception $e) 
     { 
      return false; 
     } 

     return true; 
    } else 
     return false; 
}