【问题标题】:Google Calendar (API) questionsGoogle 日历 (API) 问题
【发布时间】:2010-11-12 17:17:05
【问题描述】:

我想使用Google Calendar 添加派对活动,所以我添加了一个新日历“活动”。是否有删除该日历中所有事件的功能?

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

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

【问题讨论】:

    标签: google-api google-calendar-api


    【解决方案1】:

    这很有帮助: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");
    

    其中 [calendar] = "jo@gmail.com" 用于默认日历或在您的实例中,您的“事件”日历的 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();
    }
    

    【讨论】:

      猜你喜欢
      • 2022-01-18
      • 2011-04-23
      • 2018-08-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-02-14
      • 2021-09-25
      相关资源
      最近更新 更多