property_name = "google calendar event id"
property_type = 'String'
-exchangelib.CalendarItem.register('gcal_link',ex_gcal_link)
+try:
+ exchangelib.CalendarItem.get_field_by_fieldname('gcal_link')
+except ValueError:
+ exchangelib.CalendarItem.register('gcal_link',ex_gcal_link)
+
+#useful if you want to replay an event
+def drop_from_ex_cache(itemid):
+ with open(cachepath,"rb") as f:
+ cache = pickle.load(f)
+ cache.pop(itemid)
+ with open(cachepath,"wb") as f:
+ pickle.dump(cache,f)
def get_ex_event_by_itemid(calendar,itemid):
return calendar.get(item_id=itemid)
gevent["recurrence"] = rr
print(gevent)
else:
- logger.warning("Unable to set recurrence")
+ logger.warning("Unable to set recurrence for %s" % event.item_id)
+ continue #don't make the gcal event
gevent = gcal_acct.events().insert(calendarId=gcal_id,
body=gevent).execute()
event.gcal_link = gevent.get("id")