views:

131

answers:

1

Hi Guys I'm trying to delete multiple events from the Google Calendar API (From a date range). I get the feed correctly, this is not the problem. The probleme is the delete function. I get this error : "Error: You must specify an URI to which to post."

Can somebody please help me!

Thank You

  $service = new Zend_Gdata_Calendar($client);

  $query = $service->newEventQuery();

  $query->setUser('XXXXX');
  $query->setVisibility('private-XXXX');
  $query->setProjection('full');
  $query->setOrderby('starttime');
  $query->setStartMin('2010-01-20');
  $query->setStartMax('2010-01-28');
  // Retrieve the event list from the calendar server

  try {

      $eventFeed = $service->getCalendarEventFeed($query);

  } catch (Zend_Gdata_App_Exception $e) {

      echo "Error: " . $e->getMessage();

  }



  // Iterate through the list of events, deleting them //

  foreach ($eventFeed as $event) {

    try{
    $event->delete();
    }
    catch (Zend_Gdata_App_Exception $e) {

        echo "Error: " . $e->getMessage();

    } 

  }
A: 

It looks like you're using MagicCookie authentication, which will give you read-only access. To get read/write access you will need to use ClientAuth or AuthSub authentication.

Edit: For example, here's how to use ClientAuth:

$user = '[email protected]';
$pass = 'password';

$service = Zend_Gdata_Calendar::AUTH_SERVICE_NAME;
$client  = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $service);
$service = new Zend_Gdata_Calendar($client);

$query = $service->newEventQuery();
$query->setUser('default');
$query->setVisibility('private');
// Rest of your code.
GZipp
Thank You Very Much!! This worked!
Marc Losier