private void AddEventAttendees(IEnumerable <Attendee> recipients, Event googleEvent, bool optional) { IEnumerable <Attendee> recipeintList = recipients as IList <Attendee> ?? recipients.Take(maxAttendees).ToList(); if (!recipeintList.Any() && googleEvent == null) { return; } foreach (var recipient in recipeintList) { //Ignore recipients with invalid Email if (!recipient.Email.IsValidEmailAddress()) { continue; } var eventAttendee = new EventAttendee { DisplayName = recipient.Name, Email = recipient.Email, Optional = optional, ResponseStatus = AppointmentHelper.GetGoogleResponseStatus(recipient.MeetingResponseStatus) }; googleEvent.Attendees.Add(eventAttendee); } }
private void GetAttendees(Event googleEvent, List <Attendee> recipients, bool isOptional) { if (googleEvent != null && googleEvent.Attendees != null) { var attendees = googleEvent.Attendees.Where(attendee => attendee.Optional.GetValueOrDefault() == isOptional); foreach (var eventAttendee in attendees) { recipients.Add(new Attendee { Name = eventAttendee.DisplayName, Email = eventAttendee.Email, MeetingResponseStatus = AppointmentHelper.GetGoogleResponseStatus(eventAttendee.ResponseStatus) }); } } }