谷歌日历API:在HTML事件描述(Google Calendar API : event desc

2019-10-17 01:41发布

我插入事件到谷歌日历,我找不到我可以指定这样的描述是不是一个纯文本,但是HTML标记的方式:

request = WebRequest.Create("https://www.googleapis.com/calendar/v3/calendars/" + calendarID + "/events?pp=1&key=" + ClientID) as HttpWebRequest;
request.Headers.Add("Accept-Charset", "utf-8");
request.KeepAlive = true;
request.ContentType = "application/json";
request.Method = "POST";
request.Headers.Add("Authorization", "OAuth " + googleToken.ToString());
var actEvent = new GoogleCalendarEvent
    {
    summary = eventCalendar.Title,
    description = eventCalendar.Description,
    start = new GoogleCalendarEventTime(eventCalendar.Date),
    end = new GoogleCalendarEventTime(eventCalendar.Date.AddHours(1))
};

var data = jsonSerializer.Serialize(actEvent);
var postData = Encoding.UTF8.GetBytes(data);
Stream ws = request.GetRequestStream();
ws.Write(postData, 0, postData.Length);
ws.Close();
response = request.GetResponse();
stream = new StreamReader(response.GetResponseStream());
var result = stream.ReadToEnd().Trim();

return Json(new {Success = true});

Answer 1:

把描述这样的变量:

$variable = [
             "<span>Text here</span> <br/>
              <b>Text here</>
               ...           "
            ];


Answer 2:

如果你去到文档在这里 ,它说设置类型(MIME)中。 这意味着你可能只需要类型设置为HTML。



Answer 3:

目前仅适用于谷歌日历事件描述字段纯文本。 :-(



Answer 4:

与此战斗48小时后,雷纳托的回答为我工作,并包含一个URL链接,我编写它像这样

    <a href=https://www.myweb.com/page.pdf>Page Description</a><br/>


文章来源: Google Calendar API : event description in HTML