Google Calendar API for .net

38 views
Skip to first unread message

Projjwal Maiti

unread,
Nov 13, 2018, 4:01:23 AM11/13/18
to Google APIs Explorer Users Forum
Hi Guys,

I am new to google calendar API and there is an issue that I am facing.
Here is the illustration code.

            DateTime Today = GetUserTimeFromUTCDate(DateTime.UtcNow, Common.UserTimeZone); // Gets "now" in the clients timezone
            Today = Today.Date;
            // Define parameters of request.
            EventsResource.ListRequest request = service.Events.List(CalendarId); 
            request.TimeZone = TZConvert.WindowsToIana(Common.UserTimeZone); // Timezone = "Central Standard Time"
            request.MaxResults = 2500;
            request.TimeMin = Today.AddDays(-1 * PreviousDays); // PreviousDays = 7 ie Time Min = 06-NOV-2018 12:00:00 AM
            request.TimeMax = Today.AddDays( 1 * (NextDays+1)).AddSeconds(-1); // NextDays= 7 ie Time Max = 20-NOV-2018 11:59:59 AM
            request.ShowDeleted = false;
            request.SingleEvents = true;
            request.OrderBy = EventsResource.ListRequest.OrderByEnum.StartTime;

            // List events.
            Events events = request.Execute();


So the TimeMin is "06-NOV-2018 12:00:00 AM" and TimeMax is "20-NOV-2018 11:59:59 AM".
But events do returns events having start date as 05-NOV-2018 10:30:00 AM.

I must be doing something wrong or I must understood something wrong.

Please let me know how to filter the events by StartTime within the specified date range.

Thanks!
Pk

Projjwal Maiti

unread,
Dec 4, 2018, 8:42:56 AM12/4/18
to Google APIs Explorer Users Forum
Guys any one can please help?
Reply all
Reply to author
Forward
0 new messages