我将事件插入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});
将描述放入这样的变量中:
$variable = [
"<span>Text here</span> <br/>
<b>Text here</>
... "
];
如果转到documentation here,则表示设置类型(MIME)。这意味着您可能只需要将类型设置为HTML。
[Google日历活动说明字段中只有纯文本。 :-(
经过48小时的奋战,Renato的回答对我有用,并且包括一个URL链接,我这样编码:]
<a href=https://www.myweb.com/page.pdf>Page Description</a><br/>