![](/img/trans.png)
[英]How to create a Google calendar event with C# and Google calendar API?
[英]C# Google Calendar API - not valid Deadline calendar format
當我想執行該事件時,它沒有執行(這意味着該事件不在我的日歷中),並且我收到以下錯誤:
System.FormatException: The "Deadline calendar" google-api-dotnet-client/1.42.0.0 (gzip) value format is not valid.
知道如何解決這個問題嗎? 幾個月前它起作用了,我只是注意到它不再起作用了。
一些代碼示例:
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();
好吧,問題是應用程序名稱的格式。 我使用了該字符串中不允許的字符,例如:“á, ő”。
無論如何,謝謝你的回答::)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.