简体   繁体   English

C# Google 日历 API - 无效的截止日期日历格式

[英]C# Google Calendar API - not valid Deadline calendar format

When I want to execute the event, it doesn't execute (which means that the event is not in my calendar), and I get the following error:当我想执行该事件时,它没有执行(这意味着该事件不在我的日历中),并且我收到以下错误:

System.FormatException: The "Deadline calendar" google-api-dotnet-client/1.42.0.0 (gzip) value format is not valid.

Any idea how to fix this?知道如何解决这个问题吗? It worked some month ago and I just noticed that it doesn't work anymore.几个月前它起作用了,我只是注意到它不再起作用了。

Some code example:一些代码示例:

public static CalendarService getCalendarService
{
   get
   {
      var credential = GoogleWebAuthorizationBroker.AuthorizeAsync(new ClientSecrets { ClientId = clientId, ClientSecret = clientSecret },
      new[] { CalendarService.Scope.Calendar }, "user", CancellationToken.None).Result;
         return new CalendarService(new BaseClientService.Initializer { HttpClientInitializer = credential, ApplicationName = "Deadline calendar" });
    }
};

var ev = new Event
{
   ICalUID = project.RefId,
   Description = project.Description,
   Summary = string.Format("'{0} ({1})' project deadline", project.Name, project.RefId),
   Location = project.Location,
   Start = new EventDateTime { TimeZone = "MST", DateTime = project.EndDate.Value.Date },
   End = new EventDateTime { TimeZone = "MST", DateTime = project.EndDate.Value.Date.AddDays(1) },
   Attendees = attendees.Select(x => new EventAttendee() { Email = x.Email, Organizer = (x.Id == project.Responsible ? true : false) }).ToList()
};

var projectEvent = getCalendarService.Events.Insert(ev, "primary");
projectEvent.SendNotifications = true;
projectEvent.Execute();

Well, the problem was the format of the application name.好吧,问题是应用程序名称的格式。 I used characters which aren't allowed in this string, like: "á, ő".我使用了该字符串中不允许的字符,例如:“á, ő”。

Thanks your anwers anyway: :)无论如何,谢谢你的回答::)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM