/// <summary> /// Convert a Google Calender attendee status to an Exchange status /// </summary> /// <param name="googleAppsEvent">The Google Calendar event</param> /// <param name="user">The user to get the status for</param> /// <returns>The Exchange status for the given user</returns> public static BusyStatus ConvertParticipantStatus( ExchangeUser user, EventEntry googleAppsEvent) { BusyStatus result = BusyStatus.Busy; // Default is busy, because in order to make free-buys projections work correctly, // since in that case the participants are not set at all. string externalEmail = ConfigCache.MapToExternalDomain(user.Email); foreach (Who participant in googleAppsEvent.Participants) { if (!string.IsNullOrEmpty(participant.Email) && (participant.Email.Equals(user.Email) || participant.Email.Equals(externalEmail))) { switch (SafeGetValue(participant.Attendee_Status)) { case Who.AttendeeStatus.EVENT_ACCEPTED: result = BusyStatus.Busy; break; case Who.AttendeeStatus.EVENT_DECLINED: result = BusyStatus.Free; break; case Who.AttendeeStatus.EVENT_INVITED: result = BusyStatus.Tentative; break; case Who.AttendeeStatus.EVENT_TENTATIVE: result = BusyStatus.Tentative; break; } break; } } return(result); }