问题
Day three into my journey to filter my google calendar events by their source, I am now adding extended properties to my events which I will use to sort my events. Problem is, I can not access my extended properties. I followed this FullCalendar Event Object: Non-standard Fields (GCal) and added the below code to my own copy of the google calendar plugin. (The post answer says to include "extendedProperties: extendedProperties" but that would just break the script without having "item." first).
return {
id: item.id,
title: item.summary,
start: item.start.dateTime || item.start.date,
end: item.end.dateTime || item.end.date,
url: url,
location: item.location,
description: item.description,
extendedProperties: item.extendedProperties,
};
Then in my script I tried every combination of arg.event.extendedProperties.mykey possible, but I still get undefined. I have checked my event and it does in fact have the extended property in google calendar so the issue has somthing to do with my fullcalendar scripts. Greatly appreciate any help!
document.addEventListener('DOMContentLoaded', function() {
var calendarEl = document.getElementById('calendar');
var calendar = new FullCalendar.Calendar(calendarEl, {
plugins: [ 'interaction', 'dayGrid' , 'googleCalendar'],
defaultView: 'dayGridMonth',
contentHeight: 'auto',
defaultDate: '2019-06-07',
header: { left: 'prev,next title', center: '', right: '' },
googleCalendarApiKey: 'AIzaSyCqf1_CE',
eventSources: [
{
googleCalendarId: 'ao3q73fekndar.google.com',
className: 'blink182',
color: 'red',
},
],
eventClick: function( arg ) {
arg.jsEvent.preventDefault();
document.getElementById("val1").innerHTML = arg.event.extendedProperties.mykey;
}
});
calendar.render();
});
来源:https://stackoverflow.com/questions/56861182/cant-access-extendedproperties-from-google-calendar-import