Listing outOfOffice events from others google calendar using API? - google-calendar-api

I am working on Google Apps script that will list all Out of office events from the calendar of someone from my organization.
Calendar is made available for my organization, but limited to free/busy data (and I cannot change the sharing settings). The Out of office events are public by default, so when I open someones calendar in the Calendar application, I can see the out of office events. I am not able to do it using API.
Any ideas? :)
I tried:
let currentCalendar = CalendarApp.getCalendarById("someone#organization.com"); - returns null
response = Calendar.Events.list("someone#organization.com", params); - returns response with empty collection of events and accessRole: "freeBusyReader".

Related

Google Calendar Push Notifications: New events and event validation before/after creation

I would like to now if the following functionality is supported by google calendar api:
Does the functionality provided by "Push notifications" include new events or just existing ones. Here is a copy paste from the documentation that let me doubt that new event notifications are supported "The Google Calendar API provides push notifications that let you watch for changes to resources.". So does this only apply to already existing resources (events on my case).
Is there a way to limit the availability on the google calendar. By this I mean setting a general limit (i.e working hours for a company for example from 9am to 5pm). And putting the logic further, is there a way to add more constraints. For example after I receive a notification of a new event created (if this functionality is provided), I check the event's data in my web-hook and let google calendar know that this event shouldn't be considered as valid.
If these requirements are not provided already by google calendar API, I am open to any suggestions to accomplish this even if it takes more coding.
Just to make it clear. The context of these questions is when the user creates an event in their google calendar through google calendar web interface not through my application.

Google Calendar: limit API access to a single calendar?

I'd like for my app to add/delete/update events on a user's Google Calendar. The app only needs to delete and update events that the app itself has added.
Have I understood it correctly, that in order for this to work, the users have to give the app full access to their Google Calendars, meaning that the app could potentially read and delete private events on any calendar?
Or, is there a way to limit the access that a user gives to the app, for example, allowing the app to create a single calendar and only giving it access to events on that one calendar?
I've read through the relevant Google Calendar API, and I'm not seeing that this is possible. However, giving full access seems crazy and unnecessary!
It seems that this isn't possible. Google, why!?
What I ended up doing was skipping the API and using a calendar subscription. Limited use since the user needs to be able to set up a subscription and, especially, because Google takes up to a day to update subscribed calendars.

Find who edited google calendar event

We have a shared calender and we want to find out who edited or deleted the event using google calender api. Is there anyway we can find out this?
You need Calendar audit log.
Track calendar notifications and view changes to your users’
calendars, events, and subscriptions
You can follow the steps provided to find out who have made changes in you public calendar.
Using the API, you can visit Calendar Activity Events.

Use private google calendar in with fullcalendar

i would like to display private google calendar with fullcalendar. HTML calendar will be available just in private network and I don't want it to be public. Is it possible with fullcalendar?
Tomas
It is possible if you have Google Apps for Dmoains.
The solution is to fetch the calendar data using Google API from your server. Then serve it to fullcalendar the same way you serve events from DB and etc.
To do that, you need:
Create API account with corresponding keys
Enable the Calendar API (same site)
Allow scope access at the Google Domain admin site (under advanced security)
DL and use Google API client library to fetch the data using server side

2 way sync Google Calendar with Fullcalendar

I've been able to programmatically develop a 2 way sync between my Fullcalendar and my Google Calendar using php and javascript. My fullcalendar displays events from a Mysql database as well as events from Google calendar.
The problem I am having is that my when my mysql fullcalendar events load into my Google calendar, I then see the mysql events 2x on my fullcalendar...one from mysql and then the one coming back from Google. I need to continue displaying the event created by mysql and discontinue displaying the google events....but only the google events that originated from mysql.
In essense I need to filter out the Google Calendar events that originated from my database, but display google calendar events that were entered manually into the Google Calendar.
When I send the mysql events to google, I currentlty store the returned google calendar id, $gcal_id = $createdEvent->getId() into mysql. My intent is to read the google api callback and filter out the gCal$uid's that match the id's I stored in mysql.
I cannot figure out how to access the gCal$uid values found in the google api callback, and then compare them to an array of id's pulled from the database.
Any ideas or code snippets would be greatly appreciated.
Thank you.
I attacked the problem from a different angle and was able to solve the problem of duplicate entries appearing on my fullcalendar.
As the calendar loads each event, i compare the events id, (minus the #google), to the gcal ids I stored in the database in FullCalendar's "eventAfterRender". If I get a match I use FullCalendar's 'removeEvents' to remove the duplicate event from the Calendar.
I'm having inconsistant results. The process will work several times in a row then all of a sudden stop working. I'm still troubleshooting although it's difficult due to the lack of documentation for PHP.
Anyways, the incoming to FullCalendar from Google Calendar is a breeze compared to the outgoing to google calendar.
For the incoming you need to provide instructions to the user on how to attain their Public or Private XML feedk. The steps to get the Public XML are detailed here http://arshaw.com/fullcalendar/docs/google_calendar/
To get the Private XML just don't make your calendar public and then click the XML button in the Private section.
There are some other steps but they are all detailed in the link the provided.
I'll provide more detailed info on the outgoing sync to google once I get it all worked out
BTW- why can't you send me a private message. Is there something I need to change in my stackoverflow settings?

Resources