public void MessageMeeting(string roomAddress, string uniqueId, string securityKey) { var meeting = SecurityCheck(roomAddress, uniqueId, securityKey); if (meeting.IsNotManaged) { throw new Exception("Cannot manage this meeting"); } var item = ExchangeServiceExecuteWithImpersonationCheck(roomAddress, svc => Appointment.Bind(svc, new ItemId(uniqueId), new PropertySet(AppointmentSchema.RequiredAttendees, AppointmentSchema.OptionalAttendees, AppointmentSchema.Location))); var addresses = item.RequiredAttendees.Concat(item.OptionalAttendees) .Where(i => i.Address != null && IsExternalAttendee(i) == false) .Select(i => i.Address) .ToArray(); var smsAddresses = _smsAddressLookupService.LookupAddresses(addresses); if (smsAddresses.Any()) { _smsMessagingService.Send(smsAddresses, string.Format("Your meeting in {0} is over - please finish up ASAP - others are waiting outside.", item.Location)); } if (addresses.Any()) { _instantMessagingService.SendMessage(addresses, string.Format("Meeting in {0} is over", item.Location), string.Format("Your meeting in {0} is over - people for the next meeting are patiently waiting at the door. Please wrap up ASAP.", item.Location), InstantMessagePriority.Urgent); } }
public void MessageMeeting(IRoom room, string uniqueId) { var meeting = SecurityCheck(room, uniqueId); if (meeting.IsNotManaged) { throw new Exception("Cannot manage this meeting"); } var item = ExchangeServiceExecuteWithImpersonationCheck(room.RoomAddress, svc => Appointment.Bind(svc, new ItemId(uniqueId), new PropertySet(AppointmentSchema.RequiredAttendees, AppointmentSchema.OptionalAttendees, AppointmentSchema.Location))); var addresses = item.RequiredAttendees.Concat(item.OptionalAttendees) .Where(i => i.Address != null && IsExternalAttendee(i) == false) .Select(i => i.Address) .ToArray(); var smsAddresses = _smsAddressLookupService.LookupAddresses(addresses); if (smsAddresses.Any()) { _smsMessagingService.Send(smsAddresses, string.Format("Your meeting in {0} is over - please finish up ASAP - others are waiting outside.", item.Location)); } if (addresses.Any()) { throw new NotImplementedException("IMs not supported"); } }
public async Task MessageMeeting(IRoom room, string uniqueId) { var meeting = await SecurityCheck(room, uniqueId); if (meeting.Item1.IsNotManaged) { throw new Exception("Cannot manage this meeting"); } var addresses = meeting.Item2.Attendees.Concat(new[] { meeting.Item2.Organizer }) .Where(i => IsExternalAttendee(i) == false) .Select(i => i?.EmailAddress?.Address) .Where(i => !string.IsNullOrEmpty(i)) .ToArray(); var smsAddresses = _smsAddressLookupService.LookupAddresses(addresses); if (smsAddresses.Any()) { _smsMessagingService.Send(smsAddresses, string.Format("Your meeting in {0} is over - please finish up ASAP - others are waiting outside.", meeting.Item2.Location?.DisplayName)); } if (addresses.Any()) { throw new NotImplementedException("IMs no longer supported"); } }