Google日历(API)问题 [英] Google Calendar (API) questions

查看:121
本文介绍了Google日历(API)问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用 Google日历添加派对活动,因此我添加了新的日历,事件。是否有删除该日历中的所有事件的功能?



或者只能删除整个日历并重新创建日历?

我有每日更新的离线数据,所以我认为最好的方法是刷新整个Google日历日历并简单地上传所有活动。 Google日历.NET API文档

  //创建一个CalenderService并认证
CalendarService myService = new CalendarService(exampleCo-exampleApp-1);
myService.setUserCredentials(jo@gmail.com,mypassword);

//创建查询对象:
EventQuery query = new EventQuery();
query.Uri = new Uri(https://www.google.com/calendar/feeds/[calendar]/private/full);

其中[calendar] =jo@gmail.com为默认日历或在您的实例中,您的活动日历的ID(可在Gmail的日历中找到),即https://www.google.com/calendar/[calendarID]/private/full

  //告诉服务进行查询:
EventFeed calFeed = myService .Query(query);

//这将删除所有项目您的日历

foreach(在calFeed.Entries中的var项){
entry.Delete();
}


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.

解决方案

This is helpful: Google Calendar .NET API documentation.

// Create a CalenderService and authenticate
CalendarService myService = new CalendarService("exampleCo-exampleApp-1");
myService.setUserCredentials("jo@gmail.com", "mypassword");

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

where [calendar] = "jo@gmail.com" 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();
}

这篇关于Google日历(API)问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆