I am working in a company, I want to access the calendar events of other employees with app script. but I am getting null as there events are private. However I am able to access my own calendar events even if they are private. How can I access my other employees calendar events. I want to send an email with feedback form for all of their events.
this is the code I am using for getting calendar events of specific email. it is giving events if I provide my email but giving null If I provide same domain email of other employee. please help me if you have any thoughts or suggestions.
function getAllCalendarEvents() {
// Get the OAuth client ID and client secret from script properties
var clientId = PropertiesService.getScriptProperties().getProperty('clientId');
var clientSecret = PropertiesService.getScriptProperties().getProperty('clientSecret');
// Authorize and set up the Calendar service
var service = getService(clientId, clientSecret);
var calendar = CalendarApp.getCalendarById('abc@gmail.com');
// Retrieve all events from the calendar
var events = calendar.getEvents(new Date('2000-01-01'), new Date('2100-12-31'));
// Process the events
for (var i = 0; i < events.length; i++) {
var event = events[i];
// Access the event properties
var title = event.getTitle();
var startTime = event.getStartTime();
var endTime = event.getEndTime();
// Perform further processing as needed
Logger.log('Event: ' + title + ' (' + startTime + ' - ' + endTime + ')');
}
}