I am using the sample code from Google to populate vacation calendars.
It works rather well except I have recently noticed that it fails for recurring events. It throws error "Invalid iCalUID value" when trying to import a recurring or repeating event.
I believe this is due to the fact that, as per API documentation for 'iCalUID', "Note that the icalUID and the id are not identical and only one of them should be supplied at event creation time. One difference in their semantics is that in recurring events, all occurrences of one event have different ids while they all share the same icalUIDs." IE. it's probably due to duplicated 'icalUIDs' or similar.
There might be some way to modify/fix by using 'recurringEventId' and/or 'id' instead or in addition to 'iCalUID' but this be beyond my current time and skills. Has anyone solved the issue with this sample code already?
Related
I run a google calendar trigger for every user (10k users) which notifies some external resources when something changes in the users calendar.
However I have some issues because it seems like the triggers don't always execute in order. When for example one user moves an event several times in a second it could be that the notification to an external resource of the last event movement hits first before the others do.
When I look into the Google Stackdriver logging I also could see that the same behavior when logging the trigger. But of course the issue could also be the logger itself.
How can I fix this when my business logic relies on the correct order of changes for a calendar? I know that there is also the Push Notification for Calendar but there is no watch for a single calendar and this will also mean that I need to watch 10k of users which I don't think it's very practical.
So how can I solve this? Or am I wrong about the trigger execution order and the problem lies on the external resources execution order of requests?
I was using Google calendar Clear api but nowadays I am getting following error while clearing the calendar using calendar id.
I need to clear the calendar using calendar id. I tried the same api using following url as well and getting the same error.
Calendar Id: h9tbr9nlks0p8nrkjsgbrphci4#group.calendar.google.com
I am getting following error on every calendar.
https://developers.google.com/google-apps/calendar/v3/reference/calendars/clear
message:Cannot clear primary calendar.
Just saw the reason - silly me. The documentation clearly states :
Clears a primary calendar. This operation deletes all events associated with the primary calendar of an account.
https://developers.google.com/google-apps/calendar/v3/reference/calendars/clear
If you want to clear all events from the secondary calendar, you will have to loop through all of them and delete one by one.
If you really want to clear all events from the primary calendar, you need to pass 'primary' as a parameter.
I've read a lot of posts related to my problem... The problem is I'm not a computer programmer and it's like reading a foreign language to me. I've tried to muddle my way through it but to no avail. I've mainly been working from this post and the links from that page.
I have a Google Sheets document with a list of id numbers and a start date and end date for treatments. I'd like to be able to run a script that will auto populate a Google Calendar with the id numbers as the event title and the treatment time frame. I don't need a start and end time, I'm only looking for dates.
I would also like to create another Google Calendar from the same spreadsheet. I have 6 columns associated with each id number - a projected date and an actual date for 3 different types of testing. I would like to be able to run another script that populates a Google Calendar with the type of testing as the event title. Again, not concerned with times at all, just the dates.
I'm using this to track an experiment I'm running and it's just a lot of information to see on a spreadsheet. It would be nice easier to see all the testing I need to do in a calendar format so I don't make any more mistakes in missing testing days or when to stop treatments.
I've been trying for 3 weeks to figure this out on my own. Let's just say, I know nothing about coding...
You should try writing a function in Google Apps script.
Get the active sheet, get range and retreive the id numbers and a start date and end date.
Then create a calender event by referring to this link.
Hope that helps!
How do I obtain the triggers for another document in my account?
There are two functions to obtain a list of triggers:
ScriptApp.getProjectTriggers()
ScriptApp.getUserTriggers(document|form|spreadsheet)
The first returns only the triggers for the current project (as expected), but the second is always returning an empty array, except when called from the project where the trigger resides.
There is currently a bug in the ScriptApp.getUserTriggers() function (or its documentation).
What is happening is not that empty arrays are always returned. Rather, the getUserTriggers() function is returning the triggers associated with the calling script, rather than the script bound to the specified document|spreadsheet|form. If the calling script has no triggers, getUserTriggers() will return an empty array.
The issue has been taken up by the Apps Script team. In the meantime, it is not possible to programmatically view or manipulate triggers of a script from another script.
Not a perfect solution but I've listed this issue on the script issues page at https://code.google.com/p/google-apps-script-issues/issues/detail?id=4562&thanks=4562&ts=1416775997, as no-one seems to know the answer, so we'll need to wait for the Google team to clarify.
Please star it so that it gains visibility and traction.
Edit: As per Ryans mention below, the issue I listed has been picked up the the Apps script team (Based on the owner being 'ryanr...#google.com', I suspect it's Ryan himself who has picked it up, Thanks Ryan!). So currently the only solution is to wait for a fix I believe.
We are using Google Apps Premier and I just noticed a change in behavior with the CalendarApp.getCalendarById() function, but it must have changed in the last month or so since it was working before the Christmas break.
The previous behavior (12/2012 and before) with the CalendarApp.getCalendarById() function used to be one where a calendar object was always returned as long as the calendar resource existed. Now this function returns null unless the the user has subscribed to the calendar resource. In the testing that I have done, as long as I am subscribed I get a calendar resource object and as soon as I unsubscribe, I start getting a null object. I have not tested with regular user calendars and have only tested with resources (such as rooms).
var calendar = CalendarApp.getCalendarById(calendarID);
This is pretty annoying since I need to run scripts against many rooms which I do not want to be subscribed to. The current work around of subscribing to a room or calendar is not very workable.
This has always been the case. You must have previously been subscribed and not realized it. I assure you this code was not changed.