i need to create application which export all iCal events to isc file.Can you advice me how i can to do? With Cocoa Application, Command Line Tool or AppleScript Application?....I am trying to do this with AppleScript Application, using CalendarStore Framework.I'm able to get all events, but how to save thems to ics file??
Here is my code:
- (IBAction)btnSelector:(id)sender {
CalCalendarStore *calendarStore = [CalCalendarStore defaultCalendarStore];
NSDate *startDate=[[NSDate alloc] init];
NSDateFormatter *formatter = [[NSDateFormatter alloc] init] ;
[formatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
startDate=[formatter dateFromString:@"2010-01-01 00:00:00"];
NSDate *endDate=[[NSDate alloc] init];
endDate=[formatter dateFromString:@"2050-01-01 00:00:00"];
NSArray *calendars = [calendarStore calendars];
NSPredicate *allEventsPredicate = [CalCalendarStore eventPredicateWithStartDate:startDate endDate:endDate calendars:[calendarStore calendars]];
NSArray *events = [calendarStore eventsWithPredicate:allEventsPredicate];
for(CalEvent *event in events)
{
//here i must save event to file...
NSLog(@"%@",event);
}
for (CalCalendar *calendar in calendars) {
self.lblNotification.title=[NSString stringWithFormat:@"%@ %@",self.lblNotification.title,calendar.title];
}
}
I solved the problem...now i don't use CalendareStore framework, i just read content of calendars folder: