Hi.

I'm trying to add an attendee to an already existing event using a
Zend_Gdata_Extension_Who object.  I want to use the object's
valueString property to store the attendee's name.  However, when I
add an attendee, the value of  valueString gets set to the Email
property.  Here is the code I've been using, anonymized and pulled
together from multiple files (using PHP and Zend_Gdata 1.6.2):


define('GDATA_PATH', '/path/to/ZendGdata-1.6.2/library');
define('GDATA_ATTENDEE_STATUS_ACCEPTED', 'http://schemas.google.com/g/
2005#event.accepted');
// Enter your Google account credentials
define('GDATA_EMAIL', '[EMAIL PROTECTED]');
define('GDATA_PASSWORD', 'example');

set_include_path(get_include_path() . PATH_SEPARATOR . GDATA_PATH);
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
Zend_Loader::loadClass('Zend_Gdata_Calendar');
Zend_Loader::loadClass('Zend_Gdata_Extension_Who');
Zend_Loader::loadClass('Zend_Gdata_Extension_AttendeeStatus');

// ...
// assume Zend_Gdata_Calendar is created and authenticated
// ...

function addGuestToEvent($eventURL, $guest)
{
        try
        {
                $event = $this->gdataCal->getCalendarEventEntry($eventURL);
        }
        catch (Zend_Gdata_App_Exception $e)
        {
                echo "Error: " . $e->getMessage();
        }

        $im_coming = new Zend_Gdata_Extension_AttendeeStatus
(GDATA_ATTENDEE_STATUS_ACCEPTED);
        $guest->setAttendeeStatus($im_coming);

        $alltheguests = $event->getWho();
        $alltheguests[] = $guest;
        $event->setWho($alltheguests);
        $event->save();
}

function getGuestsForEvent($eventURL)
{
        try
        {
                $event = $this->gdataCal->getCalendarEventEntry($eventURL);
        }
        catch (Zend_Gdata_App_Exception $e)
        {
                echo "Error: " . $e->getMessage();
        }

        $alltheguests = $event->getWho();
        return $alltheguests;
}

$cal = new gcalEventsClient(GDATA_EMAIL, GDATA_PASSWORD);

$guest = new Zend_Gdata_Extension_Who('[EMAIL PROTECTED]', null,
'Some Guy');
$cal->addGuestToEvent($myEventURL, $guest); // where $myEventURL is
already set

$the_guests = $cal->getGuestsForEvent($myEventURL);

// ...
// some HTML
// ...

  <table width="100%" border="0" cellspacing="2" cellpadding="2">
    <tr>
      <th scope="col">Name</th>
      <th scope="col">Email</th>
    </tr>
<?php
        foreach ($the_guests as $guest)
{
?>
    <tr>
      <td><?php echo $guest->getValueString(); ?></td>
      <td><?php echo $guest->getEmail(); ?></td>
    </tr>
<?php
}
?>
  </table>

The new attendee gets added, but $guest->getValueString() returns the
email address '[EMAIL PROTECTED]' instead of the string 'Some
Guy'.

What am I missing here? Any help given would be greatly appreciated.

Thanks,

-Ken

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Calendar Data API" group.
To post to this group, send email to 
[email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-calendar-help-dataapi?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to