3

我编写了一个连接到 Google 日历 API 的 Perl 脚本。我遇到了一些问题。

我想删除事件> "15 Feb 2013"(有 date的事件15 Feb 2013 onward),我找不到这个变量,有人可以建议吗?

4

1 回答 1

3

Net::Google::Calendar是与 Google Calendar API 一起使用的现有库。它有一个delete_entry 方法,这似乎是你想要的。

如果我理解您的要求正确,您想查找从 2013 年 2 月 15 日开始的所有事件并删除它们?我相信那会是...

use Net::Google::Calendar;

my $cal = Net::Google::Calendar->new;
$cal->login($username, $password);

my @events = $cal->get_events(
    start-min => "2013-02-15",
);
for my $event (@events) {
    $cal->delete_entry($event);
}

使用原始 API,您将使用list获取条目,使用 timeMin 和 timeMax 来搜索它。然后使用 eventId将其删除。

https://www.googleapis.com/calendar/v3/calendars/$calendarId/events?timeMin=2013-02-15

为您获取事件列表,然后...

https://www.googleapis.com/calendar/v3/calendars/$calendarId/events/$eventId

在他们每个人上删除它们。

但是您可能应该使用该模块。

于 2013-02-18T05:52:54.613 回答