Calendar Script Help

Hello All,

So, looking for a script, that goes to an iCloud Calendar (Calendar 1) in the Calendars Application, and then deletes all the events from Calendar 1.

Then, I want it to take all the events from an Exchange Calendar (Calendar 2) and Copy them into Calendar 1.

Basically Delete all from Calendar 1, then Mirror to match Calendar 2.
Note: Some of these may be repeating events, if that makes a difference.

Can anybody help? Any experience of this?

Thanks
James

Hi. This seems probable, but you should probably test it before saving.

tell application "Calendar"
	delete calendar "dummy1"'s events
	duplicate calendar "dummy2"'s events to calendar "dummy1"
end tell

Hi,

This works for single events, but not repeating one, can you advise?

I just tested it, and it works as expected with both locally created repeating events and a linked calendar under Mavericks. Are you using Yosemite?

Hi,

Repeating events has always been a hard subject. I think that Nigel Garvey had made a script to deal with repeating events, so you might look that up. The problem with repeating events is that you can’t get a reference to the individual repeats. You only get a reference to the original event.

I think you need to read the ical fileand do all kinds of calculations and stuff That was before and today is another day, so not quite sure. :slight_smile:

gl,
kel

I remember now. You get the reference to the original event. Find what is the repeating interval. Then, calculate all repeating events to find what event lands on that certain day. Think it was something like that. Interesting stuff!

gl,
kel