Cover by Vandad Nahavandipoor

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

O'Reilly logo

14.6. Retrieving the Attendees of an Event

Problem

You want to retrieve the list of attendees for a specific event.

Solution

Use the attendees property of an instance of EKEvent. This property is of type NSArray and includes objects of type EKParticipant.

The example code that follows will retrieve all the events that happen today (whatever the day may be) and print out useful event information, including the attendees of that event, to the console window:

- (EKCalendar *) calDAVCalendarWithTitleContaining :(NSString *)paramDescription{ EKCalendar *result = nil; EKEventStore *eventStore = [[EKEventStore alloc] init]; for (EKCalendar *thisCalendar in eventStore.calendars){ if (thisCalendar.type == EKCalendarTypeCalDAV){ if ([thisCalendar.title rangeOfString:paramDescription].location != NSNotFound){ return thisCalendar; } } } return result; } - (void) enumerateTodayEvents{ /* Find a calendar to base our search on */ EKCalendar *targetCalendar = [self calDAVCalendarWithTitleContaining:@"vandad.np@gmail.com"]; /* If we could not find a CalDAV calendar that we were looking for, then we will abort the operation */ if (targetCalendar == nil){ NSLog(@"No CalDAV calendars were found."); return; } /* We have to pass an array of calendars to the event store to search */ NSArray *targetCalendars = [[NSArray alloc] initWithObjects:targetCalendar, nil]; /* Instantiate the event store */ EKEventStore *eventStore = [[EKEventStore alloc] init]; /* Construct the starting date for today */ NSDate *startDate ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required