Google 日历 (API) 问题

发布于 2024-10-02 07:44:15 字数 227 浏览 1 评论 0原文

我想使用 Google 日历来添加聚会活动,因此我添加了一个新日历,“事件”。有没有删除该日历中所有事件的功能?

或者只能通过删除整个日历并重新创建它来实现?

我有每天更新的离线数据,所以我认为最好的方法是刷新整个 Google 日历日历并简单地上传所有事件。

I'd like to use Google Calendar for adding party events, so I added a new calendar, "events". Is there a function for deleting all events in that calendar?

Or is it only possible by deleting the whole calender and re-creating it?

I'm having offline data which updates daily, so I thought the best method would be flushing the whole Google Calendar calendar and simply uploading all events.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

南…巷孤猫 2024-10-09 07:44:15

这很有帮助:Google 日历 .NET API 文档

// Create a CalenderService and authenticate
CalendarService myService = new CalendarService("exampleCo-exampleApp-1");
myService.setUserCredentials("[email protected]", "mypassword");

// Create the query object:
EventQuery query = new EventQuery();
query.Uri = new Uri("https://www.google.com/calendar/feeds/[calendar]/private/full");

其中 [calendar] = "[email protected]" 对于默认日历或在您的实例,您的“活动”日历的 ID(在 Gmail 日历中找到),即 https://www.google.com/calendar/[calendarID]/private/full”

// Tell the service to query:
EventFeed calFeed = myService .Query(query);

// This should delete all items in your calendar

foreach(var item in calFeed.Entries) {
    entry.Delete();
}

This is helpful: Google Calendar .NET API documentation.

// Create a CalenderService and authenticate
CalendarService myService = new CalendarService("exampleCo-exampleApp-1");
myService.setUserCredentials("[email protected]", "mypassword");

// Create the query object:
EventQuery query = new EventQuery();
query.Uri = new Uri("https://www.google.com/calendar/feeds/[calendar]/private/full");

where [calendar] = "[email protected]" for default calendar or in your instance, the ID of your 'events' calendar (found in calendar in Gmail), that is, https://www.google.com/calendar/[calendarID]/private/full"

// Tell the service to query:
EventFeed calFeed = myService .Query(query);

// This should delete all items in your calendar

foreach(var item in calFeed.Entries) {
    entry.Delete();
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文