我无法使用 Google 数据 API 删除事件源
大家好,我正在尝试从 Google Calendar API(从某个日期范围)删除多个事件。我正确地获取了 feed,这不是问题。问题是删除功能。我收到此错误:“错误:您必须指定要发布到的 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();
}
}
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();
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您似乎正在使用MagicCookie身份验证,这将为您提供只读访问权限。要获得读/写访问权限,您需要使用 ClientAuth 或 AuthSub 身份验证。
编辑:例如,以下是如何使用ClientAuth:
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: