Hi
Please somebody be so kind as to tell me if I am barking up the wrong tree
by trying to do this with Gadgets.
What I want to do is to check that each user has certain subscribed-to
calendars visible. We want to use this for vacation time planning. You share
you calendar with everyone else and then you see each other calendars you
are subscribed to. well if somebody accidentally clicks on a calendar then
it gets removed and I don't want users to do this by accident - hence the
check.
I was able to do it in Google Apps scripts (see attached text file) but the
script can only be called in a Spredsheet or a Site, not a calendar. That is
why I tried the Side Gadget to perhaps give a warning when the calendar is
loaded (opened) and that the user has a unselected calendar on his/hers
list.
As you cannot force the user to see the subscribed calendars I have to mess
around with scripts.
Please help :-)
Martin
--
You received this message because you are subscribed to the Google
Groups "Google Calendar Data API" group.
To post to this group, send email to
[email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://code.google.com/apis/calendar/community/forum.html
function myFunction() {
// The code below will add an event to the user's default Calendar
var cal = CalendarApp.getDefaultCalendar();
//cal.createEvent("Busy", new Date("March 12, 2011 08:00:00"), new Date("March
12, 2011 09:00:00"), {location:'Nap room'});
//Browser.msgBox("["+ cal.getName() +"\n" + cal.getDescription() + "]");
//Browser.msgBox(cal.getId() + " with name "+cal.getName())
var mycals = CalendarApp.getAllCalendars();
//Browser.msgBox(mycals[0].getId());
var eventarray = new Array();
for (var i = 0; i<mycals.length; i++)
{
var line = new Array();
line.push(mycals[i].getTitle());
line.push(mycals[i].getId());
if (mycals[i].isHidden() ) {
line.push("HIDDEN");
} else {
line.push("VISIBLE");
}
if (mycals[i].isSelected() ) {
line.push("SELECTED");
} else {
line.push("UNSELECTED");
}
//line.push(mycals[i].isHidden());
eventarray.push(line);
}
var sheet = SpreadsheetApp.getActiveSheet().getRange(2, 1, eventarray.length,
eventarray[0].length).setValues(eventarray);
/*if (cal.isHidden()) {
Browser.msgBox("The cal " + cal.getName() + " is hidden");
}
else
{ Browser.msgBox("The cal " + cal.getName() + " is visible");
}
*/
}