开发者

Google Calendar API Invalid value for start-min parameter

I am using the exact examples from the Google Calendar API in C#: 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 =开发者_Go百科 DateTime.Now.AddMonths(6);


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

This is copied from the examples, but when I run it I get:

Execution of request failed: 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

Which is the message

Invalid value for start-min parameter: 2010-11-19T23:58:20 01:00

What am I doing wrong?


You're not correctly URL encoding the plus sign in the datetime and a + represents a space in a URL...

Replace the plus with its url-encoded equivalent %2B and it all works fine...

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


I guess the problem solved itself, now I don't get that error anymore...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜