我正在将该事件插入Google日历中,我无法找到我可以指定描述不是纯文本但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});
答案 0 :(得分:0)
如果您转到documentation here,则说明设置类型(MIME)。这意味着您可能只需将类型设置为HTML。
答案 1 :(得分:0)
Google日历活动说明字段只提供纯文字。 : - (
答案 2 :(得分:0)
将描述放入这样的变量中:
$variable = [
"<span>Text here</span> <br/>
<b>Text here</>
... "
];
答案 3 :(得分:0)
与之抗争48小时后,Renato的答案对我有用,并且包括一个url链接,我这样编码
<a href=https://www.myweb.com/page.pdf>Page Description</a><br/>