Hi I'm trying to insert into my calendar but I'm having issues
inserting into a sub calendar. ( I hope that makes sense!! )

What I'm wanting to do is insert into say BIRTHDAYS instead of DEFAULT
calendar.

When I view the calendar i use setUser(big long string) to get the
BIRTHDAY calendar thats works fine but how do I insert into the non
default calendar?

=============

// load classes
      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_Http_Client');

      // connect to service
      $gcal = Zend_Gdata_Calendar::AUTH_SERVICE_NAME;
      $user = "USERNAME";
      $pass = "PASSWORD";
          $setUser =
'[email protected]';
      $client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass,
$gcal);
      $gcal = new Zend_Gdata_Calendar($client);

      // validate input
      if (empty($_POST['title'])) {
        die('ERROR: Missing title');
      }

      if (!checkdate($_POST['sdate_mm'], $_POST['sdate_dd'], $_POST
['sdate_yy'])) {
        die('ERROR: Invalid start date/time');
      }

      if (!checkdate($_POST['edate_mm'], $_POST['edate_dd'], $_POST
['edate_yy'])) {
        die('ERROR: Invalid end date/time');
      }

      $title = htmlentities($_POST['title']);
      $start = date(DATE_ATOM, mktime($_POST['sdate_hh'], $_POST
['sdate_ii'], 0, $_POST['sdate_mm'], $_POST['sdate_dd'], $_POST
['sdate_yy']));
      $end = date(DATE_ATOM, mktime($_POST['edate_hh'], $_POST
['edate_ii'], 0, $_POST['edate_mm'], $_POST['edate_dd'], $_POST
['edate_yy']));

      // construct event object
      // save to server
      try {
        $event = $gcal->newEventEntry();
        $event->title = $gcal->newTitle($title);
        $when = $gcal->newWhen();
        $when->startTime = $start;
        $when->endTime = $end;
        $event->when = array($when);

        $gcal->insertEvent($event);
      } catch (Zend_Gdata_App_Exception $e) {
        echo "Error: " . $e->getResponse();
      }
      echo 'Event successfully added!';
    }

=====================

Please help!!

Thanks,

Tim

--

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