Google Calendar API start-min参数的值无效

时间:2010-12-17 22:59:43

标签: c# google-calendar-api

我在C#中使用Google Calendar API中的确切示例:             string calendarURI = this.CalendarURI.Text;             string userName = this.UserName.Text;             string passWord = this.Password.Text;

        this.entryList = new ArrayList(50); 
        ArrayList dates = new ArrayList(50); 
        EventQuery query = new EventQuery();
        CalendarService service = new CalendarService("CalendarSampleApp");

        if (userName != null && userName.Length > 0)
        {
            service.setUserCredentials(userName, passWord);
        }

        // only get event's for today - 1 month until today + 1 year

        query.Uri = new Uri(calendarURI);

        query.StartTime = DateTime.Now.AddDays(-28); 
        query.EndTime = DateTime.Now.AddMonths(6);


        EventFeed calFeed = service.Query(query) as EventFeed;
        Console.WriteLine(query.Uri);

这是从示例中复制的,但是当我运行它时,我得到:

  

执行请求失败:http://www.google.com/calendar/feeds/default/private/full?start-min=2010-11-19T23:58:20+01:00&start-max=2011-06-17T23:58:20+02:00

消息是什么

  

start-min参数值无效:2010-11-19T23:58:20 01:00

我做错了什么?

2 个答案:

答案 0 :(得分:0)

您在日期时间中对加号进行了正确的URL编码,而+表示网址中的空格...

将plus替换为其url编码的等效%2B,这一切都正常......

  

http://www.google.com/calendar/feeds/default/private/full?start-min=2010-11-19T23:58:20%2B01:00&start-max=2011-06-17T23:58:20%2B02:00

答案 1 :(得分:0)

我猜这个问题已经解决了,现在我再也没有得到这个错误......