簡體   English   中英

使用C#中的API設置Google日歷事件的顏色

[英]Set the Color of a Google Calendar event with the API in C#

我對使用C#的Google Calendar API有疑問。 我想設置特定事件的顏色,但是無論我添加到ColorId屬性中如何,它都不會影響更新后的事件。

這是我的代碼:

 Event data = CalendarService.Events.Get("primary", id).Execute();
 data.Description = _GetDescription(done, notes, uniqueLinkId);

 Colors colors = CalendarService.Colors.Get().Execute();
 if (colors != null && colors.Calendar != null)
 {
      var color = colors.Calendar.FirstOrDefault(x => x.Value.Background == "#16a765");
      if (!string.IsNullOrWhiteSpace(color.Key))
      {
                data.ColorId = color.Key;
      }
 }

 var request = CalendarService.Events.Update(data, "primary", id);
 request.SupportsAttachments = true;
 request.SendNotifications = false;

 request.Execute();

關於這怎么不起作用的任何想法?

問候安德烈亞斯

看起來它可能是一個錯誤, CalendarList背景顏色更改不起作用(.NET)

唯一的問題是我也無法使用Google API Exporer對其進行設置。 這讓我想知道這是否是他們在發布新的Google日歷后刪除的內容。

我已經向Google發送了一封電子郵件,但是我沒有與該團隊直接聯系,所以我要等一會兒才能聽到。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM