1

嗨,伙计们,我正在尝试从 Google Calendar API(从日期范围)中删除多个事件。我得到了正确的提要,这不是问题。问题是删除功能。我收到此错误:“错误:您必须指定要发布到的 URI。”

有人能帮帮我吗!

谢谢你

  $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();

    } 

  }
4

1 回答 1

0

看起来您正在使用MagicCookie身份验证,这将为您提供只读访问权限。要获得读/写访问权限,您需要使用ClientAuthAuthSub身份验证。

编辑:例如,这里是如何使用ClientAuth

$user = 'me@example.com';
$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.
于 2010-02-03T15:22:20.967 回答