문제

Yesterday, I wrote this code :

        EventsResource.ListRequest req = service.Events.List("primary");
        req.TimeMin = DateTime.Now.AddMonths(-2).ToString("o");
        req.ShowDeleted = true;
        req.UpdatedMin = LastSync.ToString("o");
        req.SingleEvents = true;
        req.MaxResults = 5;

TimeMin and UpdateMin were strings (string? datatype).

This morning, the code breaks. So I updated the NuGet packages.

Now, those two fields (and any date field in the API) are typed "DateTime?"

So I updated my code to :

        EventsResource.ListRequest req = service.Events.List("primary");
        req.TimeMin = DateTime.Now.AddMonths(-2);
        req.ShowDeleted = true;
        req.UpdatedMin = LastSync;
        req.SingleEvents = true;
        req.MaxResults = 5;

I also tried to use "new DateTime?(DateTime.Now.AddMonths(-2))"

Now I get a "Bad Request" error as soon as TimeMin or UpdateMin is filled. If I comment thoses lines, I get events from my calendar.

What's wrong ? Bug in the new API release ?

도움이 되었습니까?

해결책

Try the new NuGet package - https://www.nuget.org/packages/Google.Apis.Calendar.v3/ It should be fixed on the new version.

We are going to announce very soon the release of 1.7.0-beta (so keep updated on http://google-api-dotnet-client.blogspot.com/)

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top