C# 通过Google日历API查询时执行请求失败

C# 通过Google日历API查询时执行请求失败,c#,windows,google-calendar-api,C#,Windows,Google Calendar Api,我正在Windows 7下使用Visual C#Express 2010。在过去的3年里,我一直在使用这段代码查询我的谷歌日历(共有4个日历),没有任何问题。然而,昨天(17/11/14),代码停止工作。代码如下: try { //fill up combobox with all calendars CalendarService myService = new CalendarService("exampleCo-exampleApp-1"); myService.s

我正在Windows 7下使用Visual C#Express 2010。在过去的3年里,我一直在使用这段代码查询我的谷歌日历(共有4个日历),没有任何问题。然而,昨天(17/11/14),代码停止工作。代码如下:

try
{
    //fill up combobox with all calendars
    CalendarService myService = new CalendarService("exampleCo-exampleApp-1");
    myService.setUserCredentials(email, password);
    CalendarQuery query = new CalendarQuery();
    query.Uri = new Uri("https://www.google.com/calendar/feeds/default/owncalendars/full");
    CalendarFeed resultFeed = (CalendarFeed) myService.Query(query); //code crashes
}
catch (GDataRequestException e)
{
    MessageBox.Show(e.Message + "\r\nCould not read from Google Calendar");
}
使用以下错误消息进行查询时,代码崩溃:

执行请求失败:

有人知道为什么前一天相同的代码正常工作时,代码突然停止工作了吗


非常感谢您的帮助。

我发现了问题。谷歌API v2于2014年11月17日被弃用,取而代之的是v3。一切都变了!顺便说一句,谢谢你编辑我的问题,尤里。我下次一定把它弄好。这里也是,两天前停止工作了。嘿,布莱恩,谢谢你评论说V2已经不推荐了。v3工作正常吗?嗨,我也面临着类似的问题,但我已经是v3了。如果您对代码进行了更改,请将其张贴在此处?